The GetWorkItemCount implementation may look strange. It's done this way because of how WaitForAllItems is implemented. Alternative solution is to introduce separate counter for GetWorkItemCount.
-- v5: d3dx10/tests: Add D3DX10CreateThreadPump tests. d3dx10: Add ID3DX10ThreadPump:PurgeAllItems implementation. d3dx10: Add ID3DX10ThreadPump:GetQueueStatus implementation. d3dx10: Add ID3DX10ThreadPump:WaitForAllItems implementation. d3dx10: Add ID3DX10ThreadPump:ProcessDeviceWorkItems implementation. d3dx10: Add ID3DX10ThreadPump:GetWorkItemCount implementation. d3dx10: Add ID3DX10ThreadPump:AddWorkItem implementation. d3dx10: Add D3DX10CreateThreadPump stub. d3dx10/tests: Fix texture leak in check_resource_data. d3dx10/tests: Build without -DWINE_NO_LONG_TYPES. d3dx10/tests: Add a couple D3DX10CreateAsyncTextureInfoProcessor() parameter tests.
From: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 1c28a62b700..b70dbb5b44f 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -1972,6 +1972,22 @@ static void test_D3DX10CreateAsyncTextureInfoProcessor(void) hr = D3DX10CreateAsyncTextureInfoProcessor(NULL, NULL); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ hr = D3DX10CreateAsyncTextureInfoProcessor(&info, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + hr = D3DX10CreateAsyncTextureInfoProcessor(NULL, &dp); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + if (0) + { + /* Crashes on native. */ + hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[0].data, test_image[0].size); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + + hr = ID3DX10DataProcessor_Destroy(dp); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = D3DX10CreateAsyncTextureInfoProcessor(&info, &dp); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/d3dx10_34/tests/Makefile.in | 2 +- dlls/d3dx10_35/tests/Makefile.in | 2 +- dlls/d3dx10_36/tests/Makefile.in | 2 +- dlls/d3dx10_37/tests/Makefile.in | 2 +- dlls/d3dx10_38/tests/Makefile.in | 2 +- dlls/d3dx10_39/tests/Makefile.in | 2 +- dlls/d3dx10_40/tests/Makefile.in | 2 +- dlls/d3dx10_41/tests/Makefile.in | 2 +- dlls/d3dx10_42/tests/Makefile.in | 2 +- dlls/d3dx10_43/tests/Makefile.in | 2 +- dlls/d3dx10_43/tests/d3dx10.c | 538 +++++++++++++++---------------- 11 files changed, 279 insertions(+), 279 deletions(-)
diff --git a/dlls/d3dx10_34/tests/Makefile.in b/dlls/d3dx10_34/tests/Makefile.in index b3cb20f944e..67ee4f4031b 100644 --- a/dlls/d3dx10_34/tests/Makefile.in +++ b/dlls/d3dx10_34/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=34 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=34 TESTDLL = d3dx10_34.dll IMPORTS = d3dx10_34 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_35/tests/Makefile.in b/dlls/d3dx10_35/tests/Makefile.in index 5d15ac0f99a..cf22bbf1422 100644 --- a/dlls/d3dx10_35/tests/Makefile.in +++ b/dlls/d3dx10_35/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=35 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=35 TESTDLL = d3dx10_35.dll IMPORTS = d3dx10_35 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_36/tests/Makefile.in b/dlls/d3dx10_36/tests/Makefile.in index a9503459208..97a7b0374a8 100644 --- a/dlls/d3dx10_36/tests/Makefile.in +++ b/dlls/d3dx10_36/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=36 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=36 TESTDLL = d3dx10_36.dll IMPORTS = d3dx10_36 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_37/tests/Makefile.in b/dlls/d3dx10_37/tests/Makefile.in index e5707117a73..ed999db15b0 100644 --- a/dlls/d3dx10_37/tests/Makefile.in +++ b/dlls/d3dx10_37/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=37 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=37 TESTDLL = d3dx10_37.dll IMPORTS = d3dx10_37 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_38/tests/Makefile.in b/dlls/d3dx10_38/tests/Makefile.in index c1507422b4d..4f444bdfd81 100644 --- a/dlls/d3dx10_38/tests/Makefile.in +++ b/dlls/d3dx10_38/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=38 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=38 TESTDLL = d3dx10_38.dll IMPORTS = d3dx10_38 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_39/tests/Makefile.in b/dlls/d3dx10_39/tests/Makefile.in index fadaf089165..b7f264cd3d4 100644 --- a/dlls/d3dx10_39/tests/Makefile.in +++ b/dlls/d3dx10_39/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=39 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=39 TESTDLL = d3dx10_39.dll IMPORTS = d3dx10_39 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_40/tests/Makefile.in b/dlls/d3dx10_40/tests/Makefile.in index f5ffaf385a8..4d16b500e89 100644 --- a/dlls/d3dx10_40/tests/Makefile.in +++ b/dlls/d3dx10_40/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=40 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=40 TESTDLL = d3dx10_40.dll IMPORTS = d3dx10_40 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_41/tests/Makefile.in b/dlls/d3dx10_41/tests/Makefile.in index afff1c75705..dbee23044cd 100644 --- a/dlls/d3dx10_41/tests/Makefile.in +++ b/dlls/d3dx10_41/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=41 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=41 TESTDLL = d3dx10_41.dll IMPORTS = d3dx10_41 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_42/tests/Makefile.in b/dlls/d3dx10_42/tests/Makefile.in index f996b86b0e6..300ce3a0492 100644 --- a/dlls/d3dx10_42/tests/Makefile.in +++ b/dlls/d3dx10_42/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=42 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=42 TESTDLL = d3dx10_42.dll IMPORTS = d3dx10_42 ole32 gdi32 PARENTSRC = ../../d3dx10_43/tests diff --git a/dlls/d3dx10_43/tests/Makefile.in b/dlls/d3dx10_43/tests/Makefile.in index 95078d0e12b..fe5e1e397bd 100644 --- a/dlls/d3dx10_43/tests/Makefile.in +++ b/dlls/d3dx10_43/tests/Makefile.in @@ -1,4 +1,4 @@ -EXTRADEFS = -DD3DX10_SDK_VERSION=43 -DWINE_NO_LONG_TYPES +EXTRADEFS = -DD3DX10_SDK_VERSION=43 TESTDLL = d3dx10_43.dll IMPORTS = d3dx10 ole32 gdi32
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index b70dbb5b44f..c0c14ef592c 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -850,17 +850,17 @@ static HRESULT WINAPI D3DX10ThreadPump_AddWorkItem(ID3DX10ThreadPump *iface, ID3 ok(!add_work_item_count++, "unexpected call\n");
hr = ID3DX10DataLoader_Load(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataLoader_Decompress(loader, &data, &size); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Process(processor, data, size); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_CreateDeviceObject(processor, object); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Destroy(processor); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataLoader_Destroy(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
if (result) *result = S_OK; return S_OK; @@ -1016,7 +1016,7 @@ static HMODULE create_resource_module(const WCHAR *filename, const void *data, u
GetModuleFileNameW(NULL, current_module_path, ARRAY_SIZE(current_module_path)); ret = CopyFileW(current_module_path, resource_module_path, FALSE); - ok(ret, "CopyFileW failed, error %u.\n", GetLastError()); + ok(ret, "CopyFileW failed, error %lu.\n", GetLastError()); SetFileAttributesW(resource_module_path, FILE_ATTRIBUTE_NORMAL);
resource = BeginUpdateResourceW(resource_module_path, TRUE); @@ -1130,7 +1130,7 @@ static void check_resource_info(ID3D10Resource *resource, const struct test_imag { case D3D10_RESOURCE_DIMENSION_TEXTURE2D: hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture_2d); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID3D10Texture2D_GetDesc(texture_2d, &desc_2d); ok_(__FILE__, line)(desc_2d.Width == expected_width, "Got unexpected Width %u, expected %u.\n", @@ -1172,7 +1172,7 @@ static void check_resource_info(ID3D10Resource *resource, const struct test_imag
case D3D10_RESOURCE_DIMENSION_TEXTURE3D: hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture3D, (void **)&texture_3d); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ID3D10Texture3D_GetDesc(texture_3d, &desc_3d); ok_(__FILE__, line)(desc_3d.Width == expected_width, "Got unexpected Width %u, expected %u.\n", @@ -1234,7 +1234,7 @@ static void check_resource_data(ID3D10Resource *resource, const struct test_imag }
hr = ID3D10Texture2D_Map(readback, 0, D3D10_MAP_READ, 0, &map); - ok_(__FILE__, line)(hr == S_OK, "Map failed, hr %#x.\n", hr); + ok_(__FILE__, line)(hr == S_OK, "Map failed, hr %#lx.\n", hr); if (hr != S_OK) { ID3D10Texture2D_Unmap(readback, 0); @@ -1398,7 +1398,7 @@ float4 main(float4 color : COLOR) : SV_TARGET for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) { hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &cb[i]); - ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#lx.\n", hr); }
buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER | D3D10_BIND_INDEX_BUFFER | D3D10_BIND_SHADER_RESOURCE; @@ -1406,7 +1406,7 @@ float4 main(float4 color : COLOR) : SV_TARGET for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) { hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer[i]); - ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#lx.\n", hr);
stride[i] = (i + 1) * 4; offset[i] = (i + 1) * 16; @@ -1417,7 +1417,7 @@ float4 main(float4 color : COLOR) : SV_TARGET for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) { hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &so_buffer[i]); - ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#lx.\n", hr); }
srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; @@ -1429,7 +1429,7 @@ float4 main(float4 color : COLOR) : SV_TARGET { hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)buffer[i % D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT], &srv_desc, &srv[i]); - ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#lx.\n", hr); }
sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; @@ -1451,21 +1451,21 @@ float4 main(float4 color : COLOR) : SV_TARGET sampler_desc.MinLOD = (float)i;
hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler[i]); - ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#lx.\n", hr); }
hr = ID3D10Device_CreateVertexShader(device, simple_vs, sizeof(simple_vs), &vs); - ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#lx.\n", hr);
hr = ID3D10Device_CreateGeometryShader(device, simple_gs, sizeof(simple_gs), &gs); - ok(SUCCEEDED(hr), "Failed to create geometry shader, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create geometry shader, hr %#lx.\n", hr);
hr = ID3D10Device_CreatePixelShader(device, simple_ps, sizeof(simple_ps), &ps); - ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#lx.\n", hr);
hr = ID3D10Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc), simple_vs, sizeof(simple_vs), &input_layout); - ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create input layout, hr %#lx.\n", hr);
blend_desc.AlphaToCoverageEnable = FALSE; blend_desc.BlendEnable[0] = FALSE; @@ -1492,7 +1492,7 @@ float4 main(float4 color : COLOR) : SV_TARGET blend_desc.RenderTargetWriteMask[7] = D3D10_COLOR_WRITE_ENABLE_ALL;
hr = ID3D10Device_CreateBlendState(device, &blend_desc, &blend_state); - ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#lx.\n", hr);
ds_desc.DepthEnable = TRUE; ds_desc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL; @@ -1510,7 +1510,7 @@ float4 main(float4 color : COLOR) : SV_TARGET ds_desc.BackFace.StencilFunc = D3D10_COMPARISON_ALWAYS;
hr = ID3D10Device_CreateDepthStencilState(device, &ds_desc, &ds_state); - ok(SUCCEEDED(hr), "Failed to create depthstencil state, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create depthstencil state, hr %#lx.\n", hr);
texture_desc.Width = 512; texture_desc.Height = 512; @@ -1527,23 +1527,23 @@ float4 main(float4 color : COLOR) : SV_TARGET for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) { hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &rt_texture[i]); - ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#lx.\n", hr); }
texture_desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; texture_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL;
hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &ds_texture); - ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#lx.\n", hr);
for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) { hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)rt_texture[i], NULL, &rtv[i]); - ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#lx.\n", hr); }
hr = ID3D10Device_CreateDepthStencilView(device, (ID3D10Resource *)ds_texture, NULL, &dsv); - ok(SUCCEEDED(hr), "Failed to create depthstencil view, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create depthstencil view, hr %#lx.\n", hr);
for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) { @@ -1569,13 +1569,13 @@ float4 main(float4 color : COLOR) : SV_TARGET rs_desc.AntialiasedLineEnable = FALSE;
hr = ID3D10Device_CreateRasterizerState(device, &rs_desc, &rs_state); - ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#lx.\n", hr);
predicate_desc.Query = D3D10_QUERY_OCCLUSION_PREDICATE; predicate_desc.MiscFlags = 0;
hr = ID3D10Device_CreatePredicate(device, &predicate_desc, &predicate); - ok(SUCCEEDED(hr), "Failed to create predicate, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create predicate, hr %#lx.\n", hr);
ID3D10Device_VSSetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, cb); ID3D10Device_VSSetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, srv); @@ -1614,7 +1614,7 @@ float4 main(float4 color : COLOR) : SV_TARGET ID3D10Device_SetPredication(device, predicate, TRUE);
hr = D3DX10UnsetAllDeviceObjects(device); - ok(SUCCEEDED(hr), "D3DX10UnsetAllDeviceObjects() failed, %#x.\n", hr); + ok(SUCCEEDED(hr), "D3DX10UnsetAllDeviceObjects() failed, %#lx.\n", hr);
ID3D10Device_VSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) @@ -1794,7 +1794,7 @@ float4 main(float4 color : COLOR) : SV_TARGET }
refcount = ID3D10Device_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); + ok(!refcount, "Device has %lu references left.\n", refcount); }
static void test_D3DX10CreateAsyncMemoryLoader(void) @@ -1806,42 +1806,42 @@ static void test_D3DX10CreateAsyncMemoryLoader(void) void *ptr;
hr = D3DX10CreateAsyncMemoryLoader(NULL, 0, NULL); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncMemoryLoader(NULL, 0, &loader); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncMemoryLoader(&data, 0, &loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
size = 100; hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(ptr == &data, "Got data pointer %p, original %p.\n", ptr, &data); ok(!size, "Got unexpected data size.\n");
/* Load() is no-op. */ hr = ID3DX10DataLoader_Load(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Destroy(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
data = 0; hr = D3DX10CreateAsyncMemoryLoader(&data, sizeof(data), &loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
/* Load() is no-op. */ hr = ID3DX10DataLoader_Load(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(ptr == &data, "Got data pointer %p, original %p.\n", ptr, &data); ok(size == sizeof(data), "Got unexpected data size.\n");
hr = ID3DX10DataLoader_Destroy(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); }
static void test_D3DX10CreateAsyncFileLoader(void) @@ -1857,59 +1857,59 @@ static void test_D3DX10CreateAsyncFileLoader(void) BOOL ret;
hr = D3DX10CreateAsyncFileLoaderA(NULL, NULL); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncFileLoaderA(NULL, &loader); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncFileLoaderA("nonexistentfilename", &loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Load(loader); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataLoader_Destroy(loader); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
/* Test file sharing using dummy empty file. */ create_file(test_filename, test_data1, sizeof(test_data1), path);
hr = D3DX10CreateAsyncFileLoaderW(path, &loader); - ok(SUCCEEDED(hr), "Failed to create file loader, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create file loader, hr %#lx.\n", hr);
ret = delete_file(test_filename); - ok(ret, "DeleteFile() failed, ret %d, error %d.\n", ret, GetLastError()); + ok(ret, "DeleteFile() failed, ret %d, error %ld.\n", ret, GetLastError());
/* File was removed before Load(). */ hr = ID3DX10DataLoader_Load(loader); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Load() returned unexpected result, hr %#x.\n", hr); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Load() returned unexpected result, hr %#lx.\n", hr);
/* Create it again. */ create_file(test_filename, test_data1, sizeof(test_data1), NULL); hr = ID3DX10DataLoader_Load(loader); - ok(SUCCEEDED(hr), "Load() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Load() failed, hr %#lx.\n", hr);
/* Already loaded. */ hr = ID3DX10DataLoader_Load(loader); - ok(SUCCEEDED(hr), "Load() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Load() failed, hr %#lx.\n", hr);
ret = delete_file(test_filename); - ok(ret, "DeleteFile() failed, ret %d, error %d.\n", ret, GetLastError()); + ok(ret, "DeleteFile() failed, ret %d, error %ld.\n", ret, GetLastError());
/* Already loaded, file removed. */ hr = ID3DX10DataLoader_Load(loader); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Load() returned unexpected result, hr %#x.\n", hr); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Load() returned unexpected result, hr %#lx.\n", hr);
/* Decompress still works. */ ptr = NULL; hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(SUCCEEDED(hr), "Decompress() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Decompress() failed, hr %#lx.\n", hr); ok(ptr != NULL, "Got unexpected ptr %p.\n", ptr); ok(size == sizeof(test_data1), "Got unexpected decompressed size.\n"); if (size == sizeof(test_data1)) @@ -1919,21 +1919,21 @@ static void test_D3DX10CreateAsyncFileLoader(void) create_file(test_filename, test_data2, sizeof(test_data2), NULL);
hr = ID3DX10DataLoader_Load(loader); - ok(SUCCEEDED(hr), "Load() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Load() failed, hr %#lx.\n", hr);
ptr = NULL; hr = ID3DX10DataLoader_Decompress(loader, &ptr, &size); - ok(SUCCEEDED(hr), "Decompress() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Decompress() failed, hr %#lx.\n", hr); ok(ptr != NULL, "Got unexpected ptr %p.\n", ptr); ok(size == sizeof(test_data2), "Got unexpected decompressed size.\n"); if (size == sizeof(test_data2)) ok(!memcmp(ptr, test_data2, size), "Got unexpected file data.\n");
hr = ID3DX10DataLoader_Destroy(loader); - ok(SUCCEEDED(hr), "Destroy() failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Destroy() failed, hr %#lx.\n", hr);
ret = delete_file(test_filename); - ok(ret, "DeleteFile() failed, ret %d, error %d.\n", ret, GetLastError()); + ok(ret, "DeleteFile() failed, ret %d, error %ld.\n", ret, GetLastError()); }
static void test_D3DX10CreateAsyncResourceLoader(void) @@ -1942,22 +1942,22 @@ static void test_D3DX10CreateAsyncResourceLoader(void) HRESULT hr;
hr = D3DX10CreateAsyncResourceLoaderA(NULL, NULL, NULL); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncResourceLoaderA(NULL, NULL, &loader); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncResourceLoaderA(NULL, "noname", &loader); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncResourceLoaderW(NULL, NULL, NULL); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncResourceLoaderW(NULL, NULL, &loader); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncResourceLoaderW(NULL, L"noname", &loader); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); }
static void test_D3DX10CreateAsyncTextureInfoProcessor(void) @@ -1970,31 +1970,31 @@ static void test_D3DX10CreateAsyncTextureInfoProcessor(void) CoInitialize(NULL);
hr = D3DX10CreateAsyncTextureInfoProcessor(NULL, NULL); - ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncTextureInfoProcessor(&info, NULL); - ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncTextureInfoProcessor(NULL, &dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
if (0) { /* Crashes on native. */ hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[0].data, test_image[0].size); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); }
hr = ID3DX10DataProcessor_Destroy(dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncTextureInfoProcessor(&info, &dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[0].data, 0); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Process(dp, NULL, test_image[0].size); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2002,7 +2002,7 @@ static void test_D3DX10CreateAsyncTextureInfoProcessor(void)
hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[i].data, test_image[i].size); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); + "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) check_image_info(&info, test_image + i, __LINE__);
@@ -2010,10 +2010,10 @@ static void test_D3DX10CreateAsyncTextureInfoProcessor(void) }
hr = ID3DX10DataProcessor_CreateDeviceObject(dp, NULL); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataProcessor_Destroy(dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
CoUninitialize(); } @@ -2036,42 +2036,42 @@ static void test_D3DX10CreateAsyncTextureProcessor(void) CoInitialize(NULL);
hr = D3DX10CreateAsyncTextureProcessor(device, NULL, NULL); - ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncTextureProcessor(NULL, NULL, &dp); - ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
hr = D3DX10CreateAsyncTextureProcessor(device, NULL, &dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[0].data, 0); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Process(dp, NULL, test_image[0].size); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); hr = ID3DX10DataProcessor_Destroy(dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { winetest_push_context("Test %u", i);
hr = D3DX10CreateAsyncTextureProcessor(device, NULL, &dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = ID3DX10DataProcessor_Process(dp, (void *)test_image[i].data, test_image[i].size); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); + "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { hr = ID3DX10DataProcessor_CreateDeviceObject(dp, (void **)&resource); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); check_resource_info(resource, test_image + i, __LINE__); check_resource_data(resource, test_image + i, __LINE__); ID3D10Resource_Release(resource); }
hr = ID3DX10DataProcessor_Destroy(dp); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
winetest_pop_context(); } @@ -2096,17 +2096,17 @@ static void test_get_image_info(void)
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromMemory(test_image[0].data, 0, NULL, &image_info, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromMemory(NULL, test_image[0].size, NULL, &image_info, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; dword = 0xdeadbeef; hr = D3DX10GetImageInfoFromMemory(&dword, sizeof(dword), NULL, &image_info, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2115,8 +2115,8 @@ static void test_get_image_info(void) hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromMemory(test_image[i].data, test_image[i].size, NULL, &image_info, &hr2); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) check_image_info(&image_info, test_image + i, __LINE__);
@@ -2127,26 +2127,26 @@ static void test_get_image_info(void) add_work_item_count = 0; hr = D3DX10GetImageInfoFromMemory(test_image[0].data, test_image[0].size, &thread_pump, &image_info, &hr2); ok(add_work_item_count == 1, "Got unexpected add_work_item_count %u.\n", add_work_item_count); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); check_image_info(&image_info, test_image, __LINE__);
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileW(NULL, NULL, &image_info, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileW(L"deadbeaf", NULL, &image_info, &hr2); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileA(NULL, NULL, &image_info, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileA("deadbeaf", NULL, &image_info, &hr2); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2156,16 +2156,16 @@ static void test_get_image_info(void) hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileW(path, NULL, &image_info, &hr2); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) check_image_info(&image_info, test_image + i, __LINE__);
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromFileA(get_str_a(path), NULL, &image_info, &hr2); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) check_image_info(&image_info, test_image + i, __LINE__);
@@ -2178,20 +2178,20 @@ static void test_get_image_info(void)
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceW(NULL, NULL, NULL, &image_info, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceW(NULL, L"deadbeaf", NULL, &image_info, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceA(NULL, NULL, NULL, &image_info, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceA(NULL, "deadbeaf", NULL, &image_info, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2200,15 +2200,15 @@ static void test_get_image_info(void)
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceW(resource_module, L"deadbeef", NULL, &image_info, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2);
hr2 = 0xdeadbeef; hr = D3DX10GetImageInfoFromResourceW(resource_module, test_resource_name, NULL, &image_info, &hr2); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP) || broken(hr == D3DX10_ERR_INVALID_DATA) /* Vista */, - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) check_image_info(&image_info, test_image + i, __LINE__);
@@ -2216,8 +2216,8 @@ static void test_get_image_info(void) hr = D3DX10GetImageInfoFromResourceA(resource_module, get_str_a(test_resource_name), NULL, &image_info, &hr2); ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP) || broken(hr == D3DX10_ERR_INVALID_DATA) /* Vista */, - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) check_image_info(&image_info, test_image + i, __LINE__);
@@ -2253,36 +2253,36 @@ static void test_create_texture(void) resource = (ID3D10Resource *)0xdeadbeef; hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(NULL, test_bmp_1bpp, sizeof(test_bmp_1bpp), NULL, NULL, &resource, &hr2); - ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); ok(resource == (ID3D10Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource);
resource = (ID3D10Resource *)0xdeadbeef; hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, NULL, 0, NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); ok(resource == (ID3D10Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource);
resource = (ID3D10Resource *)0xdeadbeef; hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, NULL, sizeof(test_bmp_1bpp), NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); ok(resource == (ID3D10Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource);
resource = (ID3D10Resource *)0xdeadbeef; hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, test_bmp_1bpp, 0, NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); ok(resource == (ID3D10Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource);
resource = (ID3D10Resource *)0xdeadbeef; hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, test_bmp_1bpp, sizeof(test_bmp_1bpp) - 1, NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); ok(resource == (ID3D10Resource *)0xdeadbeef, "Got unexpected resource %p.\n", resource);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) @@ -2291,10 +2291,10 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, test_image[i].data, test_image[i].size, NULL, NULL, &resource, &hr2); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); + "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { check_resource_info(resource, test_image + i, __LINE__); @@ -2310,8 +2310,8 @@ static void test_create_texture(void) hr = D3DX10CreateTextureFromMemory(device, test_image[0].data, test_image[0].size, NULL, &thread_pump, &resource, &hr2); ok(add_work_item_count == 1, "Got unexpected add_work_item_count %u.\n", add_work_item_count); - ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); check_resource_info(resource, test_image, __LINE__); check_resource_data(resource, test_image, __LINE__); ID3D10Resource_Release(resource); @@ -2320,20 +2320,20 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileW(device, NULL, NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileW(device, L"deadbeef", NULL, NULL, &resource, &hr2); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileA(device, NULL, NULL, NULL, &resource, &hr2); - ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileA(device, "deadbeef", NULL, NULL, &resource, &hr2); - ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3D10_ERROR_FILE_NOT_FOUND, "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2342,10 +2342,10 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileW(device, path, NULL, NULL, &resource, &hr2); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); + "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { check_resource_info(resource, test_image + i, __LINE__); @@ -2355,10 +2355,10 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileA(device, get_str_a(path), NULL, NULL, &resource, &hr2); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); + "Got unexpected hr %#lx.\n", hr); if (hr == S_OK) { check_resource_info(resource, test_image + i, __LINE__); @@ -2374,20 +2374,20 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceW(device, NULL, NULL, NULL, NULL, &resource, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceW(device, NULL, L"deadbeef", NULL, NULL, &resource, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceA(device, NULL, NULL, NULL, NULL, &resource, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2); hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceA(device, NULL, "deadbeef", NULL, NULL, &resource, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2);
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { @@ -2396,16 +2396,16 @@ static void test_create_texture(void)
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceW(device, resource_module, L"deadbeef", NULL, NULL, &resource, &hr2); - ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr); - ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#x.\n", hr2); + ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#lx.\n", hr); + ok(hr2 == 0xdeadbeef, "Got unexpected hr2 %#lx.\n", hr2);
hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromResourceW(device, resource_module, test_resource_name, NULL, NULL, &resource, &hr2); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) { check_resource_info(resource, test_image + i, __LINE__); @@ -2418,8 +2418,8 @@ static void test_create_texture(void) get_str_a(test_resource_name), NULL, NULL, &resource, &hr2); todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), - "Got unexpected hr %#x.\n", hr); - ok(hr == hr2, "Got unexpected hr2 %#x.\n", hr2); + "Got unexpected hr %#lx.\n", hr); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); if (hr == S_OK) { check_resource_info(resource, test_image + i, __LINE__); @@ -2439,10 +2439,10 @@ static void test_create_texture(void) #define check_rect(rect, left, top, right, bottom) _check_rect(__LINE__, rect, left, top, right, bottom) static inline void _check_rect(unsigned int line, const RECT *rect, int left, int top, int right, int bottom) { - ok_(__FILE__, line)(rect->left == left, "Unexpected rect.left %d\n", rect->left); - ok_(__FILE__, line)(rect->top == top, "Unexpected rect.top %d\n", rect->top); - ok_(__FILE__, line)(rect->right == right, "Unexpected rect.right %d\n", rect->right); - ok_(__FILE__, line)(rect->bottom == bottom, "Unexpected rect.bottom %d\n", rect->bottom); + ok_(__FILE__, line)(rect->left == left, "Unexpected rect.left %ld\n", rect->left); + ok_(__FILE__, line)(rect->top == top, "Unexpected rect.top %ld\n", rect->top); + ok_(__FILE__, line)(rect->right == right, "Unexpected rect.right %ld\n", rect->right); + ok_(__FILE__, line)(rect->bottom == bottom, "Unexpected rect.bottom %ld\n", rect->bottom); }
static void test_font(void) @@ -2500,7 +2500,7 @@ static void test_font(void) ref = get_refcount(device); hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Failed to create a font, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to create a font, hr %#lx.\n", hr); ok(ref < get_refcount(device), "Unexpected device refcount.\n"); ID3DX10Font_Release(font); ok(ref == get_refcount(device), "Unexpected device refcount.\n"); @@ -2508,32 +2508,32 @@ static void test_font(void) /* Zero size */ hr = D3DX10CreateFontA(device, 0, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Failed to create a font, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to create a font, hr %#lx.\n", hr); ID3DX10Font_Release(font);
/* Unspecified font name */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, NULL, &font); - ok(hr == S_OK, "Failed to create a font, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to create a font, hr %#lx.\n", hr); ID3DX10Font_Release(font);
/* Empty font name */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "", &font); - ok(hr == S_OK, "Failed to create a font, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to create a font, hr %#lx.\n", hr); ID3DX10Font_Release(font);
hr = D3DX10CreateFontA(NULL, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateFontA(NULL, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
/* D3DX10CreateFontIndirect */ desc.Height = 12; @@ -2547,28 +2547,28 @@ static void test_font(void) desc.PitchAndFamily = DEFAULT_PITCH; strcpy(desc.FaceName, "Tahoma"); hr = D3DX10CreateFontIndirectA(device, &desc, &font); - ok(hr == S_OK, "Failed to create a font, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to create a font, hr %#lx.\n", hr); ID3DX10Font_Release(font);
hr = D3DX10CreateFontIndirectA(NULL, &desc, &font); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateFontIndirectA(device, NULL, &font); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateFontIndirectA(device, &desc, NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
/* GetDevice */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_GetDevice(font, NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_GetDevice(font, &device2); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ID3D10Device_Release(device2);
ID3DX10Font_Release(font); @@ -2576,13 +2576,13 @@ static void test_font(void) /* GetDesc */ hr = D3DX10CreateFontA(device, 12, 8, FW_BOLD, 2, TRUE, ANSI_CHARSET, OUT_RASTER_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_GetDescA(font, NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_GetDescA(font, &desc); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(desc.Height == 12, "Unexpected height %d.\n", desc.Height); ok(desc.Width == 8, "Unexpected width %u.\n", desc.Width); @@ -2600,7 +2600,7 @@ static void test_font(void) /* GetDC + GetTextMetrics */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hdc = ID3DX10Font_GetDC(font); ok(!!hdc, "Unexpected hdc %p.\n", hdc); @@ -2611,27 +2611,27 @@ static void test_font(void) ret = ID3DX10Font_GetTextMetricsA(font, &metrics); ok(ret, "Unexpected ret %#x.\n", ret);
- ok(metrics.tmHeight == expmetrics.tmHeight, "Unexpected height %d, expected %d.\n", + ok(metrics.tmHeight == expmetrics.tmHeight, "Unexpected height %ld, expected %ld.\n", metrics.tmHeight, expmetrics.tmHeight); - ok(metrics.tmAscent == expmetrics.tmAscent, "Unexpected ascent %d, expected %d.\n", + ok(metrics.tmAscent == expmetrics.tmAscent, "Unexpected ascent %ld, expected %ld.\n", metrics.tmAscent, expmetrics.tmAscent); - ok(metrics.tmDescent == expmetrics.tmDescent, "Unexpected descent %d, expected %d.\n", + ok(metrics.tmDescent == expmetrics.tmDescent, "Unexpected descent %ld, expected %ld.\n", metrics.tmDescent, expmetrics.tmDescent); - ok(metrics.tmInternalLeading == expmetrics.tmInternalLeading, "Unexpected internal leading %d, expected %d.\n", + ok(metrics.tmInternalLeading == expmetrics.tmInternalLeading, "Unexpected internal leading %ld, expected %ld.\n", metrics.tmInternalLeading, expmetrics.tmInternalLeading); - ok(metrics.tmExternalLeading == expmetrics.tmExternalLeading, "Unexpected external leading %d, expected %d.\n", + ok(metrics.tmExternalLeading == expmetrics.tmExternalLeading, "Unexpected external leading %ld, expected %ld.\n", metrics.tmExternalLeading, expmetrics.tmExternalLeading); - ok(metrics.tmAveCharWidth == expmetrics.tmAveCharWidth, "Unexpected average char width %d, expected %d.\n", + ok(metrics.tmAveCharWidth == expmetrics.tmAveCharWidth, "Unexpected average char width %ld, expected %ld.\n", metrics.tmAveCharWidth, expmetrics.tmAveCharWidth); - ok(metrics.tmMaxCharWidth == expmetrics.tmMaxCharWidth, "Unexpected maximum char width %d, expected %d.\n", + ok(metrics.tmMaxCharWidth == expmetrics.tmMaxCharWidth, "Unexpected maximum char width %ld, expected %ld.\n", metrics.tmMaxCharWidth, expmetrics.tmMaxCharWidth); - ok(metrics.tmWeight == expmetrics.tmWeight, "Unexpected weight %d, expected %d.\n", + ok(metrics.tmWeight == expmetrics.tmWeight, "Unexpected weight %ld, expected %ld.\n", metrics.tmWeight, expmetrics.tmWeight); - ok(metrics.tmOverhang == expmetrics.tmOverhang, "Unexpected overhang %d, expected %d.\n", + ok(metrics.tmOverhang == expmetrics.tmOverhang, "Unexpected overhang %ld, expected %ld.\n", metrics.tmOverhang, expmetrics.tmOverhang); - ok(metrics.tmDigitizedAspectX == expmetrics.tmDigitizedAspectX, "Unexpected digitized x aspect %d, expected %d.\n", + ok(metrics.tmDigitizedAspectX == expmetrics.tmDigitizedAspectX, "Unexpected digitized x aspect %ld, expected %ld.\n", metrics.tmDigitizedAspectX, expmetrics.tmDigitizedAspectX); - ok(metrics.tmDigitizedAspectY == expmetrics.tmDigitizedAspectY, "Unexpected digitized y aspect %d, expected %d.\n", + ok(metrics.tmDigitizedAspectY == expmetrics.tmDigitizedAspectY, "Unexpected digitized y aspect %ld, expected %ld.\n", metrics.tmDigitizedAspectY, expmetrics.tmDigitizedAspectY); ok(metrics.tmFirstChar == expmetrics.tmFirstChar, "Unexpected first char %u, expected %u.\n", metrics.tmFirstChar, expmetrics.tmFirstChar); @@ -2657,66 +2657,66 @@ static void test_font(void) /* PreloadText */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_PreloadTextA(font, NULL, -1); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextA(font, NULL, 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextA(font, NULL, 1); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextA(font, "test", -1); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextA(font, "", 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextA(font, "", -1); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_PreloadTextW(font, NULL, -1); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextW(font, NULL, 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextW(font, NULL, 1); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextW(font, testW, -1); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextW(font, L"", 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadTextW(font, L"", -1); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ID3DX10Font_Release(font);
/* GetGlyphData, PreloadGlyphs, PreloadCharacters */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hdc = ID3DX10Font_GetDC(font); ok(!!hdc, "Unexpected hdc %p.\n", hdc);
hr = ID3DX10Font_GetGlyphData(font, 0, NULL, &blackbox, &cellinc); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_GetGlyphData(font, 0, &srv, NULL, &cellinc); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D10ShaderResourceView_Release(srv); hr = ID3DX10Font_GetGlyphData(font, 0, &srv, &blackbox, NULL); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) ID3D10ShaderResourceView_Release(srv);
hr = ID3DX10Font_PreloadCharacters(font, 'b', 'a'); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Font_PreloadGlyphs(font, 1, 0); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Font_PreloadCharacters(font, 'a', 'a'); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
for (c = 'b'; c <= 'z'; ++c) { @@ -2726,7 +2726,7 @@ static void test_font(void)
hr = ID3DX10Font_GetGlyphData(font, glyph, &srv, &blackbox, &cellinc); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (FAILED(hr)) { @@ -2736,7 +2736,7 @@ static void test_font(void)
ID3D10ShaderResourceView_GetResource(srv, &resource); hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ID3D10Resource_Release(resource);
ID3D10Texture2D_GetDesc(texture, &texture_desc); @@ -2763,13 +2763,13 @@ static void test_font(void) ret = ID3DX10Font_GetTextMetricsW(font, &tm); ok(ret, "Unexpected ret %#x.\n", ret);
- todo_wine ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2, "Got %d, expected %d.\n", + todo_wine ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2, "Got %ld, expected %d.\n", blackbox.right - blackbox.left, glyph_metrics.gmBlackBoxX + 2); - todo_wine ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2, "Got %d, expected %d.\n", + todo_wine ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2, "Got %ld, expected %d.\n", blackbox.bottom - blackbox.top, glyph_metrics.gmBlackBoxY + 2); - ok(cellinc.x == glyph_metrics.gmptGlyphOrigin.x - 1, "Got %d, expected %d.\n", + ok(cellinc.x == glyph_metrics.gmptGlyphOrigin.x - 1, "Got %ld, expected %ld.\n", cellinc.x, glyph_metrics.gmptGlyphOrigin.x - 1); - ok(cellinc.y == tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1, "Got %d, expected %d.\n", + ok(cellinc.y == tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1, "Got %ld, expected %ld.\n", cellinc.y, tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1);
ID3D10Texture2D_Release(texture); @@ -2777,14 +2777,14 @@ static void test_font(void) }
hr = ID3DX10Font_PreloadCharacters(font, 'a', 'z'); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
#if D3DX10_SDK_VERSION > 34 /* Test multiple textures. * Native d3dx10_34.dll shows signs of memory corruption in this call. */ hr = ID3DX10Font_PreloadGlyphs(font, 0, 1000); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); #endif
/* Test glyphs that are not rendered */ @@ -2793,7 +2793,7 @@ static void test_font(void) srv = (void *)0xdeadbeef; hr = ID3DX10Font_GetGlyphData(font, glyph, &srv, &blackbox, &cellinc); todo_wine { - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!srv, "Unexpected resource view %p.\n", srv); } } @@ -2806,7 +2806,7 @@ static void test_font(void) winetest_push_context("Test %u", i); hr = D3DX10CreateFontA(device, tests[i].font_height, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hdc = ID3DX10Font_GetDC(font); ok(!!hdc, "Unexpected hdc %p.\n", hdc); @@ -2816,7 +2816,7 @@ static void test_font(void)
hr = ID3DX10Font_GetGlyphData(font, glyph, &srv, NULL, NULL); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
if (FAILED(hr)) { @@ -2827,7 +2827,7 @@ static void test_font(void)
ID3D10ShaderResourceView_GetResource(srv, &resource); hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&texture); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ID3D10Resource_Release(resource);
ID3D10Texture2D_GetDesc(texture, &texture_desc); @@ -2846,11 +2846,11 @@ static void test_font(void)
/* DrawText */ hr = D3DX10CreateSprite(device, 0, &sprite); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); SetRect(&rect, 0, 0, 640, 480);
hr = ID3DX10Sprite_Begin(sprite, 0); - ok (hr == S_OK, "Unexpected hr %#x.\n", hr); + ok (hr == S_OK, "Unexpected hr %#lx.\n", hr);
height = ID3DX10Font_DrawTextW(font, sprite, testW, -1, &rect, DT_TOP, white); ok(height == tests[i].font_height, "Unexpected height %u.\n", height); @@ -2865,13 +2865,13 @@ static void test_font(void) height = ID3DX10Font_DrawTextW(font, sprite, testW, size, &rect, DT_LEFT | DT_CALCRECT, white); ok(height == tests[i].font_height, "Unexpected height %u.\n", height); - ok(!rect.left, "Unexpected rect left %d.\n", rect.left); - ok(!rect.top, "Unexpected rect top %d.\n", rect.top); - ok(rect.right, "Unexpected rect right %d.\n", rect.right); - ok(rect.bottom == tests[i].font_height, "Unexpected rect bottom %d.\n", rect.bottom); + ok(!rect.left, "Unexpected rect left %ld.\n", rect.left); + ok(!rect.top, "Unexpected rect top %ld.\n", rect.top); + ok(rect.right, "Unexpected rect right %ld.\n", rect.right); + ok(rect.bottom == tests[i].font_height, "Unexpected rect bottom %ld.\n", rect.bottom);
hr = ID3DX10Sprite_End(sprite); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ID3DX10Sprite_Release(sprite);
ID3DX10Font_Release(font); @@ -2884,7 +2884,7 @@ static void test_font(void) /* DrawText */ hr = D3DX10CreateFontA(device, 12, 0, FW_DONTCARE, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
SetRect(&rect, 10, 10, 200, 200);
@@ -3401,41 +3401,41 @@ static void test_sprite(void) texture_desc.MiscFlags = 0;
hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture1); - ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#lx.\n", hr);
hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &texture2); - ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#lx.\n", hr);
hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture1, NULL, &srv1); - ok(SUCCEEDED(hr), "Failed to create srv, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create srv, hr %#lx.\n", hr);
hr = ID3D10Device_CreateShaderResourceView(device, (ID3D10Resource *)texture1, NULL, &srv2); - ok(SUCCEEDED(hr), "Failed to create srv, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to create srv, hr %#lx.\n", hr);
hr = D3DX10CreateSprite(device, 0, NULL); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateSprite(NULL, 0, &sprite); - ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
hr = D3DX10CreateSprite(device, 0, &sprite); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* GetDevice */ hr = ID3DX10Sprite_GetDevice(sprite, NULL); - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_GetDevice(sprite, &device2); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(device == device2, "Unexpected device.\n");
ID3D10Device_Release(device2);
/* Projection transform */ hr = ID3DX10Sprite_GetProjectionTransform(sprite, NULL); - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Sprite_GetProjectionTransform(sprite, &mat); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!memcmp(&mat, &identity, sizeof(mat)), "Unexpected projection transform.\n");
/* Set a transform and test if it gets returned correctly */ @@ -3445,90 +3445,90 @@ static void test_sprite(void) mat.m[3][0] = 6.7f; mat.m[3][1] =-5.1f; mat.m[3][2] = 6.1f; mat.m[3][3] = 2.2f;
hr = ID3DX10Sprite_SetProjectionTransform(sprite, NULL); - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_SetProjectionTransform(sprite, &mat); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_GetProjectionTransform(sprite, &mat2); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(!memcmp(&mat, &mat2, sizeof(mat)), "Unexpected matrix.\n");
/* View transform */ hr = ID3DX10Sprite_SetViewTransform(sprite, NULL); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_SetViewTransform(sprite, &mat); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Begin */ hr = ID3DX10Sprite_Begin(sprite, 0); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* Flush/End */ hr = ID3DX10Sprite_Flush(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_End(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* May not be called before next Begin */ hr = ID3DX10Sprite_Flush(sprite); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr); hr = ID3DX10Sprite_End(sprite); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
/* Draw */ hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, NULL, 0); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
memset(&sprite_desc, 0, sizeof(sprite_desc)); hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, &sprite_desc, 0); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, &sprite_desc, 1); todo_wine - ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_Begin(sprite, 0); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
memset(&sprite_desc, 0, sizeof(sprite_desc)); hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, &sprite_desc, 1); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
sprite_desc.pTexture = srv1; hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, &sprite_desc, 1); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_Flush(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_Flush(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = ID3DX10Sprite_End(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
/* D3DX10_SPRITE_ADDREF_TEXTURES */ hr = ID3DX10Sprite_Begin(sprite, D3DX10_SPRITE_ADDREF_TEXTURES); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
memset(&sprite_desc, 0, sizeof(sprite_desc)); sprite_desc.pTexture = srv1; @@ -3536,18 +3536,18 @@ static void test_sprite(void) refcount = get_refcount(srv1); hr = ID3DX10Sprite_DrawSpritesBuffered(sprite, &sprite_desc, 1); todo_wine { - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(get_refcount(srv1) > refcount, "Unexpected refcount.\n"); }
hr = ID3DX10Sprite_Flush(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(get_refcount(srv1) == refcount, "Unexpected refcount.\n");
hr = ID3DX10Sprite_End(sprite); todo_wine - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ID3DX10Sprite_Release(sprite); ID3D10Texture2D_Release(texture1); @@ -3574,7 +3574,7 @@ static void test_create_effect_from_resource(void)
hr = D3DX10CreateEffectFromResourceA(GetModuleHandleA(NULL), "resource", NULL, NULL, NULL, "fx_4_0", 0, 0, device, NULL, NULL, &effect, NULL, NULL); - ok(hr == D3DX10_ERR_INVALID_DATA, "Unexpected hr %#x.\n", hr); + ok(hr == D3DX10_ERR_INVALID_DATA, "Unexpected hr %#lx.\n", hr);
refcount = ID3D10Device_Release(device); ok(!refcount, "Unexpected refcount.\n");
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index c0c14ef592c..c9bdf90eaf4 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -1237,7 +1237,7 @@ static void check_resource_data(ID3D10Resource *resource, const struct test_imag ok_(__FILE__, line)(hr == S_OK, "Map failed, hr %#lx.\n", hr); if (hr != S_OK) { - ID3D10Texture2D_Unmap(readback, 0); + ID3D10Texture2D_Release(readback); return; }
@@ -1253,6 +1253,7 @@ static void check_resource_data(ID3D10Resource *resource, const struct test_imag }
ID3D10Texture2D_Unmap(readback, 0); + ID3D10Texture2D_Release(readback); }
static void test_D3DX10UnsetAllDeviceObjects(void) @@ -2078,7 +2079,7 @@ static void test_D3DX10CreateAsyncTextureProcessor(void)
CoUninitialize();
- ID3D10Device_Release(device); + ok(!ID3D10Device_Release(device), "Unexpected refcount.\n"); }
static void test_get_image_info(void) @@ -2433,7 +2434,7 @@ static void test_create_texture(void)
CoUninitialize();
- ID3D10Device_Release(device); + ok(!ID3D10Device_Release(device), "Unexpected refcount.\n"); }
#define check_rect(rect, left, top, right, bottom) _check_rect(__LINE__, rect, left, top, right, bottom)
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/async.c | 123 ++++++++++++++++++++++++++++++++++ dlls/d3dx10_43/d3dx10_43.spec | 2 +- include/d3dx10core.h | 1 + 3 files changed, 125 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index bb1cf30a217..7913f634c21 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -609,3 +609,126 @@ HRESULT WINAPI D3DX10PreprocessShaderFromMemory(const char *data, SIZE_T data_si
return E_NOTIMPL; } + +struct thread_pump +{ + ID3DX10ThreadPump ID3DX10ThreadPump_iface; + LONG refcount; +}; + +static inline struct thread_pump *impl_from_ID3DX10ThreadPump(ID3DX10ThreadPump *iface) +{ + return CONTAINING_RECORD(iface, struct thread_pump, ID3DX10ThreadPump_iface); +} + +static HRESULT WINAPI thread_pump_QueryInterface(ID3DX10ThreadPump *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_ID3DX10ThreadPump) + || IsEqualGUID(riid, &IID_IUnknown)) + { + ID3DX10ThreadPump_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI thread_pump_AddRef(ID3DX10ThreadPump *iface) +{ + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + ULONG refcount = InterlockedIncrement(&thread_pump->refcount); + + TRACE("%p increasing refcount to %lu.\n", iface, refcount); + + return refcount; +} + +static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface) +{ + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + ULONG refcount = InterlockedDecrement(&thread_pump->refcount); + + TRACE("%p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + free(thread_pump); + + return refcount; +} + +static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10DataLoader *loader, + ID3DX10DataProcessor *processor, HRESULT *result, void **object) +{ + FIXME("iface %p, loader %p, processor %p, result %p, object %p stub!\n", + iface, loader, processor, result, object); + return E_NOTIMPL; +} + +static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return 0; +} + +static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *iface, UINT count) +{ + FIXME("iface %p, count %u stub!\n", iface, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface) +{ + FIXME("iface %p stub!\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface, + UINT *io_queue, UINT *process_queue, UINT *device_queue) +{ + FIXME("iface %p, io_queue %p, process_queue %p, device_queue %p stub!\n", + iface, io_queue, process_queue, device_queue); + return E_NOTIMPL; +} + +static const ID3DX10ThreadPumpVtbl thread_pump_vtbl = +{ + thread_pump_QueryInterface, + thread_pump_AddRef, + thread_pump_Release, + thread_pump_AddWorkItem, + thread_pump_GetWorkItemCount, + thread_pump_WaitForAllItems, + thread_pump_ProcessDeviceWorkItems, + thread_pump_PurgeAllItems, + thread_pump_GetQueueStatus +}; + +HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump) +{ + struct thread_pump *object; + + TRACE("io_threads %u, proc_threads %u, pump %p.\n", io_threads, proc_threads, pump); + + if (io_threads >= 1024 || proc_threads >= 1024) + return E_FAIL; + + if (!(object = calloc(1, sizeof(*object)))) + return E_OUTOFMEMORY; + + object->ID3DX10ThreadPump_iface.lpVtbl = &thread_pump_vtbl; + object->refcount = 1; + + *pump = &object->ID3DX10ThreadPump_iface; + return S_OK; +} diff --git a/dlls/d3dx10_43/d3dx10_43.spec b/dlls/d3dx10_43/d3dx10_43.spec index 95160a067c5..2359c7c6f02 100644 --- a/dlls/d3dx10_43/d3dx10_43.spec +++ b/dlls/d3dx10_43/d3dx10_43.spec @@ -1,4 +1,4 @@ -@ stub D3DX10CreateThreadPump(long long ptr) +@ stdcall D3DX10CreateThreadPump(long long ptr) @ stdcall D3DX10CheckVersion(long long) @ stub D3DX10CompileFromFileA(str ptr ptr str str long long ptr ptr ptr ptr) @ stub D3DX10CompileFromFileW(wstr ptr ptr str str long long ptr ptr ptr ptr) diff --git a/include/d3dx10core.h b/include/d3dx10core.h index a9ba7854e90..cca9052cc13 100644 --- a/include/d3dx10core.h +++ b/include/d3dx10core.h @@ -298,3 +298,4 @@ HRESULT WINAPI D3DX10CreateFontW(ID3D10Device *device, INT height, UINT width, U UINT miplevels, BOOL italic, UINT charset, UINT precision, UINT quality, UINT pitchandfamily, const WCHAR *facename, ID3DX10Font **font); HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite **sprite); +HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump);
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx10_43/async.c | 248 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 245 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 7913f634c21..b22967e13fd 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -23,6 +23,7 @@ #include "dxhelpers.h"
#include "wine/debug.h" +#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@@ -610,10 +611,47 @@ HRESULT WINAPI D3DX10PreprocessShaderFromMemory(const char *data, SIZE_T data_si return E_NOTIMPL; }
+struct work_item +{ + struct list entry; + + ID3DX10DataLoader *loader; + ID3DX10DataProcessor *processor; + HRESULT *result; + void **object; +}; + +static inline void work_item_free(struct work_item *work_item, BOOL cancel) +{ + ID3DX10DataLoader_Destroy(work_item->loader); + ID3DX10DataProcessor_Destroy(work_item->processor); + if (cancel && work_item->result) + *work_item->result = S_FALSE; + free(work_item); +} + +#define THREAD_PUMP_EXITING UINT_MAX struct thread_pump { ID3DX10ThreadPump ID3DX10ThreadPump_iface; LONG refcount; + + SRWLOCK io_lock; + CONDITION_VARIABLE io_cv; + unsigned int io_count; + struct list io_queue; + + SRWLOCK proc_lock; + CONDITION_VARIABLE proc_cv; + unsigned int proc_count; + struct list proc_queue; + + SRWLOCK device_lock; + unsigned int device_count; + struct list device_queue; + + unsigned int thread_count; + HANDLE threads[1]; };
static inline struct thread_pump *impl_from_ID3DX10ThreadPump(ID3DX10ThreadPump *iface) @@ -652,11 +690,49 @@ static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface) { struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); ULONG refcount = InterlockedDecrement(&thread_pump->refcount); + struct work_item *item, *next; + struct list list; + unsigned int i;
TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
if (!refcount) + { + AcquireSRWLockExclusive(&thread_pump->io_lock); + thread_pump->io_count = THREAD_PUMP_EXITING; + ReleaseSRWLockExclusive(&thread_pump->io_lock); + WakeAllConditionVariable(&thread_pump->io_cv); + + AcquireSRWLockExclusive(&thread_pump->proc_lock); + thread_pump->proc_count = THREAD_PUMP_EXITING; + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + WakeAllConditionVariable(&thread_pump->proc_cv); + + AcquireSRWLockExclusive(&thread_pump->device_lock); + thread_pump->device_count = THREAD_PUMP_EXITING; + ReleaseSRWLockExclusive(&thread_pump->device_lock); + + for (i = 0; i < thread_pump->thread_count; ++i) + { + if (!thread_pump->threads[i]) + continue; + + WaitForSingleObject(thread_pump->threads[i], INFINITE); + CloseHandle(thread_pump->threads[i]); + } + + list_init(&list); + list_move_tail(&list, &thread_pump->io_queue); + list_move_tail(&list, &thread_pump->proc_queue); + list_move_tail(&list, &thread_pump->device_queue); + LIST_FOR_EACH_ENTRY_SAFE(item, next, &list, struct work_item, entry) + { + list_remove(&item->entry); + work_item_free(item, TRUE); + } + free(thread_pump); + }
return refcount; } @@ -664,9 +740,30 @@ static ULONG WINAPI thread_pump_Release(ID3DX10ThreadPump *iface) static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10DataLoader *loader, ID3DX10DataProcessor *processor, HRESULT *result, void **object) { - FIXME("iface %p, loader %p, processor %p, result %p, object %p stub!\n", + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + struct work_item *work_item; + + TRACE("iface %p, loader %p, processor %p, result %p, object %p.\n", iface, loader, processor, result, object); - return E_NOTIMPL; + + work_item = malloc(sizeof(*work_item)); + if (!work_item) + return E_OUTOFMEMORY; + + work_item->loader = loader; + work_item->processor = processor; + work_item->result = result; + work_item->object = object; + + if (object) + *object = NULL; + + AcquireSRWLockExclusive(&thread_pump->io_lock); + ++thread_pump->io_count; + list_add_tail(&thread_pump->io_queue, &work_item->entry); + ReleaseSRWLockExclusive(&thread_pump->io_lock); + WakeConditionVariable(&thread_pump->io_cv); + return S_OK; }
static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface) @@ -714,20 +811,165 @@ static const ID3DX10ThreadPumpVtbl thread_pump_vtbl = thread_pump_GetQueueStatus };
+static DWORD WINAPI io_thread(void *arg) +{ + struct thread_pump *thread_pump = arg; + struct work_item *work_item; + HRESULT hr; + + TRACE("%p thread started.\n", thread_pump); + + for (;;) + { + AcquireSRWLockExclusive(&thread_pump->io_lock); + + while (!thread_pump->io_count) + SleepConditionVariableSRW(&thread_pump->io_cv, &thread_pump->io_lock, INFINITE, 0); + + if (thread_pump->io_count == THREAD_PUMP_EXITING) + { + ReleaseSRWLockExclusive(&thread_pump->io_lock); + return 0; + } + + --thread_pump->io_count; + work_item = LIST_ENTRY(list_head(&thread_pump->io_queue), struct work_item, entry); + list_remove(&work_item->entry); + ReleaseSRWLockExclusive(&thread_pump->io_lock); + + if (FAILED(hr = ID3DX10DataLoader_Load(work_item->loader))) + { + if (work_item->result) + *work_item->result = hr; + work_item_free(work_item, FALSE); + continue; + } + + AcquireSRWLockExclusive(&thread_pump->proc_lock); + if (thread_pump->proc_count == THREAD_PUMP_EXITING) + { + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + work_item_free(work_item, TRUE); + return 0; + } + + list_add_tail(&thread_pump->proc_queue, &work_item->entry); + ++thread_pump->proc_count; + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + WakeConditionVariable(&thread_pump->proc_cv); + } + return 0; +} + +static DWORD WINAPI proc_thread(void *arg) +{ + struct thread_pump *thread_pump = arg; + struct work_item *work_item; + SIZE_T size; + void *data; + HRESULT hr; + + TRACE("%p thread started.\n", thread_pump); + + for (;;) + { + AcquireSRWLockExclusive(&thread_pump->proc_lock); + + while (!thread_pump->proc_count) + SleepConditionVariableSRW(&thread_pump->proc_cv, &thread_pump->proc_lock, INFINITE, 0); + + if (thread_pump->proc_count == THREAD_PUMP_EXITING) + { + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + return 0; + } + + --thread_pump->proc_count; + work_item = LIST_ENTRY(list_head(&thread_pump->proc_queue), struct work_item, entry); + list_remove(&work_item->entry); + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + + if (FAILED(hr = ID3DX10DataLoader_Decompress(work_item->loader, &data, &size))) + { + if (work_item->result) + *work_item->result = hr; + work_item_free(work_item, FALSE); + continue; + } + + if (thread_pump->device_count == THREAD_PUMP_EXITING) + { + work_item_free(work_item, TRUE); + return 0; + } + + if (FAILED(hr = ID3DX10DataProcessor_Process(work_item->processor, data, size))) + { + if (work_item->result) + *work_item->result = hr; + work_item_free(work_item, FALSE); + continue; + } + + AcquireSRWLockExclusive(&thread_pump->device_lock); + if (thread_pump->device_count == THREAD_PUMP_EXITING) + { + ReleaseSRWLockExclusive(&thread_pump->device_lock); + work_item_free(work_item, TRUE); + return 0; + } + + list_add_tail(&thread_pump->device_queue, &work_item->entry); + ++thread_pump->device_count; + ReleaseSRWLockExclusive(&thread_pump->device_lock); + } + return 0; +} + HRESULT WINAPI D3DX10CreateThreadPump(UINT io_threads, UINT proc_threads, ID3DX10ThreadPump **pump) { struct thread_pump *object; + unsigned int i;
TRACE("io_threads %u, proc_threads %u, pump %p.\n", io_threads, proc_threads, pump);
if (io_threads >= 1024 || proc_threads >= 1024) return E_FAIL;
- if (!(object = calloc(1, sizeof(*object)))) + if (!io_threads) + io_threads = 1; + if (!proc_threads) + { + SYSTEM_INFO info; + + GetSystemInfo(&info); + proc_threads = info.dwNumberOfProcessors; + } + + if (!(object = calloc(1, FIELD_OFFSET(struct thread_pump, threads[io_threads + proc_threads])))) return E_OUTOFMEMORY;
object->ID3DX10ThreadPump_iface.lpVtbl = &thread_pump_vtbl; object->refcount = 1; + InitializeSRWLock(&object->io_lock); + InitializeConditionVariable(&object->io_cv); + list_init(&object->io_queue); + InitializeSRWLock(&object->proc_lock); + InitializeConditionVariable(&object->proc_cv); + list_init(&object->proc_queue); + InitializeSRWLock(&object->device_lock); + list_init(&object->device_queue); + object->thread_count = io_threads + proc_threads; + + for (i = 0; i < object->thread_count; ++i) + { + object->threads[i] = CreateThread(NULL, 0, i < io_threads ? io_thread : proc_thread, object, 0, NULL); + if (!object->threads[i]) + { + ID3DX10ThreadPump_Release(&object->ID3DX10ThreadPump_iface); + return E_FAIL; + } + }
*pump = &object->ID3DX10ThreadPump_iface; return S_OK;
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/async.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index b22967e13fd..2eb27d0f535 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -636,6 +636,8 @@ struct thread_pump ID3DX10ThreadPump ID3DX10ThreadPump_iface; LONG refcount;
+ LONG processing_count; + SRWLOCK io_lock; CONDITION_VARIABLE io_cv; unsigned int io_count; @@ -758,6 +760,7 @@ static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10D if (object) *object = NULL;
+ InterlockedIncrement(&thread_pump->processing_count); AcquireSRWLockExclusive(&thread_pump->io_lock); ++thread_pump->io_count; list_add_tail(&thread_pump->io_queue, &work_item->entry); @@ -768,8 +771,15 @@ static HRESULT WINAPI thread_pump_AddWorkItem(ID3DX10ThreadPump *iface, ID3DX10D
static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface) { - FIXME("iface %p stub!\n", iface); - return 0; + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + UINT ret; + + TRACE("iface %p.\n", iface); + + AcquireSRWLockExclusive(&thread_pump->device_lock); + ret = thread_pump->processing_count + thread_pump->device_count; + ReleaseSRWLockExclusive(&thread_pump->device_lock); + return ret; }
static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface) @@ -842,6 +852,7 @@ static DWORD WINAPI io_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); + InterlockedDecrement(&thread_pump->processing_count); continue; }
@@ -894,6 +905,7 @@ static DWORD WINAPI proc_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); + InterlockedDecrement(&thread_pump->processing_count); continue; }
@@ -908,6 +920,7 @@ static DWORD WINAPI proc_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); + InterlockedDecrement(&thread_pump->processing_count); continue; }
@@ -921,6 +934,7 @@ static DWORD WINAPI proc_thread(void *arg)
list_add_tail(&thread_pump->device_queue, &work_item->entry); ++thread_pump->device_count; + InterlockedDecrement(&thread_pump->processing_count); ReleaseSRWLockExclusive(&thread_pump->device_lock); } return 0;
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx10_43/async.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 2eb27d0f535..5aaaabc041f 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -790,8 +790,34 @@ static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface)
static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *iface, UINT count) { - FIXME("iface %p, count %u stub!\n", iface, count); - return E_NOTIMPL; + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + struct work_item *work_item; + HRESULT hr; + UINT i; + + TRACE("iface %p, count %u.\n", iface, count); + + for (i = 0; i < count; ++i) + { + AcquireSRWLockExclusive(&thread_pump->device_lock); + if (!thread_pump->device_count) + { + ReleaseSRWLockExclusive(&thread_pump->device_lock); + break; + } + + --thread_pump->device_count; + work_item = LIST_ENTRY(list_head(&thread_pump->device_queue), struct work_item, entry); + list_remove(&work_item->entry); + ReleaseSRWLockExclusive(&thread_pump->device_lock); + + hr = ID3DX10DataProcessor_CreateDeviceObject(work_item->processor, work_item->object); + if (work_item->result) + *work_item->result = hr; + work_item_free(work_item, FALSE); + } + + return S_OK; }
static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface)
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/async.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 5aaaabc041f..9573195cdab 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -21,6 +21,7 @@ #include "d3dx10.h" #include "d3dcompiler.h" #include "dxhelpers.h" +#include "winternl.h"
#include "wine/debug.h" #include "wine/list.h" @@ -784,8 +785,32 @@ static UINT WINAPI thread_pump_GetWorkItemCount(ID3DX10ThreadPump *iface)
static HRESULT WINAPI thread_pump_WaitForAllItems(ID3DX10ThreadPump *iface) { - FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + HRESULT hr; + LONG v; + + TRACE("iface %p.\n", iface); + + for (;;) + { + if (FAILED((hr = ID3DX10ThreadPump_ProcessDeviceWorkItems(iface, UINT_MAX)))) + return hr; + + AcquireSRWLockExclusive(&thread_pump->device_lock); + if (thread_pump->device_count) + { + ReleaseSRWLockExclusive(&thread_pump->device_lock); + continue; + } + v = thread_pump->processing_count; + ReleaseSRWLockExclusive(&thread_pump->device_lock); + if (!v) + break; + + RtlWaitOnAddress(&thread_pump->processing_count, &v, sizeof(v), NULL); + } + + return S_OK; }
static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *iface, UINT count) @@ -878,7 +903,8 @@ static DWORD WINAPI io_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); - InterlockedDecrement(&thread_pump->processing_count); + if (!InterlockedDecrement(&thread_pump->processing_count)) + RtlWakeAddressAll(&thread_pump->processing_count); continue; }
@@ -931,7 +957,8 @@ static DWORD WINAPI proc_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); - InterlockedDecrement(&thread_pump->processing_count); + if (!InterlockedDecrement(&thread_pump->processing_count)) + RtlWakeAddressAll(&thread_pump->processing_count); continue; }
@@ -946,7 +973,8 @@ static DWORD WINAPI proc_thread(void *arg) if (work_item->result) *work_item->result = hr; work_item_free(work_item, FALSE); - InterlockedDecrement(&thread_pump->processing_count); + if (!InterlockedDecrement(&thread_pump->processing_count)) + RtlWakeAddressAll(&thread_pump->processing_count); continue; }
@@ -961,6 +989,7 @@ static DWORD WINAPI proc_thread(void *arg) list_add_tail(&thread_pump->device_queue, &work_item->entry); ++thread_pump->device_count; InterlockedDecrement(&thread_pump->processing_count); + RtlWakeAddressAll(&thread_pump->processing_count); ReleaseSRWLockExclusive(&thread_pump->device_lock); } return 0;
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/async.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 9573195cdab..8fc232681c5 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -854,9 +854,15 @@ static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface) static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface, UINT *io_queue, UINT *process_queue, UINT *device_queue) { - FIXME("iface %p, io_queue %p, process_queue %p, device_queue %p stub!\n", + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + + TRACE("iface %p, io_queue %p, process_queue %p, device_queue %p.\n", iface, io_queue, process_queue, device_queue); - return E_NOTIMPL; + + *io_queue = thread_pump->io_count; + *process_queue = thread_pump->proc_count; + *device_queue = thread_pump->device_count; + return S_OK; }
static const ID3DX10ThreadPumpVtbl thread_pump_vtbl =
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/async.c | 46 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dx10_43/async.c b/dlls/d3dx10_43/async.c index 8fc232681c5..667219b3500 100644 --- a/dlls/d3dx10_43/async.c +++ b/dlls/d3dx10_43/async.c @@ -845,10 +845,52 @@ static HRESULT WINAPI thread_pump_ProcessDeviceWorkItems(ID3DX10ThreadPump *ifac return S_OK; }
+static void purge_list(struct list *list, LONG *count) +{ + struct work_item *work_item; + + while (!list_empty(list)) + { + work_item = LIST_ENTRY(list_head(list), struct work_item, entry); + list_remove(&work_item->entry); + work_item_free(work_item, TRUE); + + if (count && !InterlockedDecrement(count)) + RtlWakeAddressAll(count); + } +} + static HRESULT WINAPI thread_pump_PurgeAllItems(ID3DX10ThreadPump *iface) { - FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + struct thread_pump *thread_pump = impl_from_ID3DX10ThreadPump(iface); + LONG v; + + TRACE("iface %p.\n", iface); + + for (;;) + { + AcquireSRWLockExclusive(&thread_pump->io_lock); + purge_list(&thread_pump->io_queue, &thread_pump->processing_count); + thread_pump->io_count = 0; + ReleaseSRWLockExclusive(&thread_pump->io_lock); + + AcquireSRWLockExclusive(&thread_pump->proc_lock); + purge_list(&thread_pump->proc_queue, &thread_pump->processing_count); + thread_pump->proc_count = 0; + ReleaseSRWLockExclusive(&thread_pump->proc_lock); + + AcquireSRWLockExclusive(&thread_pump->device_lock); + purge_list(&thread_pump->device_queue, NULL); + thread_pump->device_count = 0; + v = thread_pump->processing_count; + ReleaseSRWLockExclusive(&thread_pump->device_lock); + if (!v) + break; + + RtlWaitOnAddress(&thread_pump->processing_count, &v, sizeof(v), NULL); + } + + return S_OK; }
static HRESULT WINAPI thread_pump_GetQueueStatus(ID3DX10ThreadPump *iface,
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 373 ++++++++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index c9bdf90eaf4..66c34be9507 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -2082,6 +2082,378 @@ static void test_D3DX10CreateAsyncTextureProcessor(void) ok(!ID3D10Device_Release(device), "Unexpected refcount.\n"); }
+static DWORD main_tid; +static DWORD io_tid; + +struct data_object +{ + ID3DX10DataLoader ID3DX10DataLoader_iface; + ID3DX10DataProcessor ID3DX10DataProcessor_iface; + + HANDLE load_started; + HANDLE load_done; + HANDLE decompress_done; + HRESULT load_ret; + + DWORD process_tid; +}; + +static struct data_object *data_object_from_ID3DX10DataLoader(ID3DX10DataLoader *iface) +{ + return CONTAINING_RECORD(iface, struct data_object, ID3DX10DataLoader_iface); +} + +static LONG data_loader_load_count; +static WINAPI HRESULT data_loader_Load(ID3DX10DataLoader *iface) +{ + struct data_object *data_object = data_object_from_ID3DX10DataLoader(iface); + DWORD ret; + + ok(InterlockedDecrement(&data_loader_load_count) >= 0, "Got unexpected call.\n"); + + if (!io_tid) + io_tid = GetCurrentThreadId(); + ok(io_tid != main_tid, "Load called in main thread.\n"); + ok(io_tid == GetCurrentThreadId(), "Load called in wrong thread.\n"); + + SetEvent(data_object->load_started); + ret = WaitForSingleObject(data_object->load_done, INFINITE); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx.\n", ret); + return data_object->load_ret; +} + +static LONG data_loader_decompress_count; +static WINAPI HRESULT data_loader_Decompress(ID3DX10DataLoader *iface, void **data, SIZE_T *bytes) +{ + struct data_object *data_object = data_object_from_ID3DX10DataLoader(iface); + DWORD ret; + + ok(InterlockedDecrement(&data_loader_decompress_count) >= 0, "Got unexpected call.\n"); + ok(!!data, "Got unexpected data %p.\n", data); + ok(!!bytes, "Got unexpected bytes %p.\n", bytes); + + data_object->process_tid = GetCurrentThreadId(); + ok(data_object->process_tid != main_tid, "Decompress called in main thread.\n"); + ok(data_object->process_tid != io_tid, "Decompress called in IO thread.\n"); + + *data = (void *)0xdeadbeef; + *bytes = 0xdead; + ret = WaitForSingleObject(data_object->decompress_done, INFINITE); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx.\n", ret); + return S_OK; +} + +static LONG data_loader_destroy_count; +static WINAPI HRESULT data_loader_Destroy(ID3DX10DataLoader *iface) +{ + ok(InterlockedDecrement(&data_loader_destroy_count) >= 0, "Got unexpected call.\n"); + return S_OK; +} + +static ID3DX10DataLoaderVtbl D3DX10DataLoaderVtbl = +{ + data_loader_Load, + data_loader_Decompress, + data_loader_Destroy +}; + +static struct data_object* data_object_from_ID3DX10DataProcessor(ID3DX10DataProcessor *iface) +{ + return CONTAINING_RECORD(iface, struct data_object, ID3DX10DataProcessor_iface); +} + +static LONG data_processor_process_count; +static HRESULT WINAPI data_processor_Process(ID3DX10DataProcessor *iface, void *data, SIZE_T bytes) +{ + struct data_object *data_object = data_object_from_ID3DX10DataProcessor(iface); + + ok(InterlockedDecrement(&data_processor_process_count) >= 0, "Got unexpected call.\n"); + ok(data_object->process_tid == GetCurrentThreadId(), "Process called in unexpected thread.\n"); + + ok(data == (void *)0xdeadbeef, "Got unexpected data %p.\n", data); + ok(bytes == 0xdead, "Got unexpected bytes %lu.\n", bytes); + return S_OK; +} + +static LONG data_processor_create_count; +static HRESULT WINAPI data_processor_CreateDeviceObject(ID3DX10DataProcessor *iface, void **object) +{ + ok(InterlockedDecrement(&data_processor_create_count) >= 0, "Got unexpected call.\n"); + ok(main_tid == GetCurrentThreadId(), "CreateDeviceObject not called in main thread.\n"); + + *object = (void *)0xdeadf00d; + return S_OK; +} + +static LONG data_processor_destroy_count; +static HRESULT WINAPI data_processor_Destroy(ID3DX10DataProcessor *iface) +{ + struct data_object *data_object = data_object_from_ID3DX10DataProcessor(iface); + + ok(InterlockedDecrement(&data_processor_destroy_count) >= 0, "Got unexpected call.\n"); + + CloseHandle(data_object->load_started); + CloseHandle(data_object->load_done); + CloseHandle(data_object->decompress_done); + free(data_object); + return S_OK; +} + +static ID3DX10DataProcessorVtbl D3DX10DataProcessorVtbl = +{ + data_processor_Process, + data_processor_CreateDeviceObject, + data_processor_Destroy +}; + +static struct data_object *create_data_object(HRESULT load_ret) +{ + struct data_object *data_object = malloc(sizeof(*data_object)); + + data_object->ID3DX10DataLoader_iface.lpVtbl = &D3DX10DataLoaderVtbl; + data_object->ID3DX10DataProcessor_iface.lpVtbl = &D3DX10DataProcessorVtbl; + + data_object->load_started = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!data_object->load_started, "CreateEvent failed, error %lu.\n", GetLastError()); + data_object->load_done = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!data_object->load_done, "CreateEvent failed, error %lu.\n", GetLastError()); + data_object->decompress_done = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(!!data_object->decompress_done, "CreateEvent failed, error %lu.\n", GetLastError()); + data_object->load_ret = load_ret; + + return data_object; +} + +static void test_D3DX10CreateThreadPump(void) +{ + UINT io_count, process_count, device_count, count; + struct data_object *data_object[2]; + ID3DX10DataProcessor *processor; + D3DX10_IMAGE_INFO image_info; + ID3DX10DataLoader *loader; + HRESULT hr, work_item_hr; + ID3D10Resource *resource; + ID3DX10ThreadPump *pump; + ID3D10Device *device; + SYSTEM_INFO info; + void *object; + DWORD ret; + int i; + + main_tid = GetCurrentThreadId(); + + hr = D3DX10CreateThreadPump(1024, 0, &pump); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + hr = D3DX10CreateThreadPump(0, 1024, &pump); + ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr); + + GetSystemInfo(&info); + if (info.dwNumberOfProcessors > 1) + hr = D3DX10CreateThreadPump(0, 0, &pump); + else + hr = D3DX10CreateThreadPump(0, 2, &pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + count = ID3DX10ThreadPump_GetWorkItemCount(pump); + ok(!count, "GetWorkItemCount returned %u.\n", count); + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!io_count, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(!device_count, "Got unexpected device_count %u.\n", device_count); + + data_object[0] = create_data_object(E_NOTIMPL); + data_object[1] = create_data_object(S_OK); + + data_loader_load_count = 1; + hr = ID3DX10ThreadPump_AddWorkItem(pump, &data_object[0]->ID3DX10DataLoader_iface, + &data_object[0]->ID3DX10DataProcessor_iface, &work_item_hr, NULL); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ret = WaitForSingleObject(data_object[0]->load_started, INFINITE); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx.\n", ret); + ok(!data_loader_load_count, "Got unexpected data_loader_load_count %ld.\n", + data_loader_load_count); + count = ID3DX10ThreadPump_GetWorkItemCount(pump); + ok(count == 1, "GetWorkItemCount returned %u.\n", count); + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!io_count, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(!device_count, "Got unexpected device_count %u.\n", device_count); + + hr = ID3DX10ThreadPump_AddWorkItem(pump, &data_object[1]->ID3DX10DataLoader_iface, + &data_object[1]->ID3DX10DataProcessor_iface, NULL, &object); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ret = WaitForSingleObject(data_object[0]->load_started, 50); + ok(ret == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx.\n", ret); + count = ID3DX10ThreadPump_GetWorkItemCount(pump); + ok(count == 2, "GetWorkItemCount returned %u.\n", count); + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(io_count == 1, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(!device_count, "Got unexpected device_count %u.\n", device_count); + + data_loader_load_count = 1; + data_loader_destroy_count = 1; + data_processor_destroy_count = 1; + SetEvent(data_object[0]->load_done); + ret = WaitForSingleObject(data_object[1]->load_started, INFINITE); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx.\n", ret); + ok(work_item_hr == E_NOTIMPL, "Got unexpected work_item_hr %#lx.\n", work_item_hr); + ok(!data_loader_destroy_count, "Got unexpected data_loader_destroy_count %ld.\n", + data_loader_destroy_count); + ok(!data_processor_destroy_count, "Got unexpected data_processor_destroy_count %ld.\n", + data_processor_destroy_count); + ok(!data_loader_load_count, "Got unexpected data_loader_load_count %ld.\n", + data_loader_load_count); + + data_loader_decompress_count = 1; + data_processor_process_count = 1; + SetEvent(data_object[1]->load_done); + SetEvent(data_object[1]->decompress_done); + + data_processor_create_count = 1; + data_loader_destroy_count = 1; + data_processor_destroy_count = 1; + hr = ID3DX10ThreadPump_WaitForAllItems(pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(object == (void *)0xdeadf00d, "Got unexpected object %p.\n", object); + ok(!data_loader_decompress_count, "Got unexpected data_loader_decompress_count %ld.\n", + data_loader_decompress_count); + ok(!data_processor_process_count, "Got unexpected data_processor_process_count %ld.\n", + data_processor_process_count); + ok(!data_processor_create_count, "Got unexpected data_processor_create_count %ld.\n", + data_processor_create_count); + ok(!data_loader_destroy_count, "Got unexpected data_loader_destroy_count %ld.\n", + data_loader_destroy_count); + ok(!data_processor_destroy_count, "Got unexpected data_processor_destroy_count %ld.\n", + data_processor_destroy_count); + + data_object[0] = create_data_object(S_OK); + data_object[1] = create_data_object(S_OK); + SetEvent(data_object[0]->load_done); + SetEvent(data_object[1]->load_done); + SetEvent(data_object[1]->decompress_done); + + data_loader_load_count = 2; + data_loader_decompress_count = 2; + data_processor_process_count = 1; + hr = ID3DX10ThreadPump_AddWorkItem(pump, &data_object[0]->ID3DX10DataLoader_iface, + &data_object[0]->ID3DX10DataProcessor_iface, NULL, &object); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_AddWorkItem(pump, &data_object[1]->ID3DX10DataLoader_iface, + &data_object[1]->ID3DX10DataProcessor_iface, NULL, &object); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + for (;;) + { + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + if (hr != S_OK || device_count) + break; + Sleep(1); + } + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!io_count, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(device_count == 1, "Got unexpected device_count %u.\n", device_count); + ok(!data_loader_load_count, "Got unexpected data_loader_load_count %ld.\n", + data_loader_load_count); + ok(!data_loader_decompress_count, "Got unexpected data_loader_decompress_count %ld.\n", + data_loader_decompress_count); + ok(!data_processor_process_count, "Got unexpected data_processor_process_count %ld.\n", + data_processor_process_count); + + hr = ID3DX10ThreadPump_ProcessDeviceWorkItems(pump, 0); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!io_count, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(device_count == 1, "Got unexpected device_count %u.\n", device_count); + + data_processor_create_count = 1; + data_loader_destroy_count = 1; + data_processor_destroy_count = 1; + hr = ID3DX10ThreadPump_ProcessDeviceWorkItems(pump, 1); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_GetQueueStatus(pump, &io_count, &process_count, &device_count); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(!io_count, "Got unexpected io_count %u.\n", io_count); + ok(!process_count, "Got unexpected process_count %u.\n", process_count); + ok(!device_count, "Got unexpected device_count %u.\n", device_count); + ok(!data_processor_create_count, "Got unexpected data_processor_create_count %ld.\n", + data_processor_create_count); + ok(!data_loader_destroy_count, "Got unexpected data_loader_destroy_count %ld.\n", + data_loader_destroy_count); + ok(!data_processor_destroy_count, "Got unexpected data_processor_destroy_count %ld.\n", + data_processor_destroy_count); + + data_processor_process_count = 1; + data_loader_destroy_count = 1; + data_processor_destroy_count = 1; + SetEvent(data_object[0]->decompress_done); + hr = ID3DX10ThreadPump_PurgeAllItems(pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + data_processor_process_count = 0; + ok(!data_loader_destroy_count, "Got unexpected data_loader_destroy_count %ld.\n", + data_loader_destroy_count); + ok(!data_processor_destroy_count, "Got unexpected data_processor_destroy_count %ld.\n", + data_processor_destroy_count); + + device = create_device(); + if (!device) + { + skip("Failed to create device, skipping tests.\n"); + ID3DX10ThreadPump_Release(pump); + return; + } + + for (i = 0; i < ARRAY_SIZE(test_image); ++i) + { + winetest_push_context("Test %u", i); + + hr = D3DX10CreateAsyncMemoryLoader(test_image[i].data, test_image[i].size, &loader); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = D3DX10CreateAsyncTextureInfoProcessor(&image_info, &processor); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, &work_item_hr, NULL); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_WaitForAllItems(pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + ok(work_item_hr == S_OK || (work_item_hr == E_FAIL + && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "Got unexpected hr %#lx.\n", work_item_hr); + if (work_item_hr == S_OK) + check_image_info(&image_info, test_image + i, __LINE__); + + hr = D3DX10CreateAsyncMemoryLoader(test_image[i].data, test_image[i].size, &loader); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = D3DX10CreateAsyncTextureProcessor(device, NULL, &processor); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, &work_item_hr, (void **)&resource); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + hr = ID3DX10ThreadPump_WaitForAllItems(pump); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + todo_wine_if(test_image[i].expected_info.MiscFlags & D3D10_RESOURCE_MISC_TEXTURECUBE) + ok(work_item_hr == S_OK || (work_item_hr == E_FAIL + && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "Got unexpected hr %#lx.\n", work_item_hr); + if (work_item_hr == S_OK) + { + check_resource_info(resource, test_image + i, __LINE__); + check_resource_data(resource, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + + winetest_pop_context(); + } + + ok(!ID3D10Device_Release(device), "Got unexpected refcount.\n"); + + ret = ID3DX10ThreadPump_Release(pump); + ok(!ret, "Got unexpected refcount %lu.\n", ret); +} + static void test_get_image_info(void) { static const WCHAR test_resource_name[] = L"resource.data"; @@ -3589,6 +3961,7 @@ START_TEST(d3dx10) test_D3DX10CreateAsyncResourceLoader(); test_D3DX10CreateAsyncTextureInfoProcessor(); test_D3DX10CreateAsyncTextureProcessor(); + test_D3DX10CreateThreadPump(); test_get_image_info(); test_create_texture(); test_font();
Sorry for the wait. I pushed with a few small formatting tweaks and a couple patches in front, mostly getting rid of -DWINE_NO_LONG_TYPES from d3dx10/tests.