From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/texture.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index 7a43d8409da..31775fd6863 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -631,17 +631,33 @@ HRESULT WINAPI D3DX10CreateTextureFromFileW(ID3D10Device *device, const WCHAR *s if (!src_file) return E_FAIL;
- if (FAILED((hr = load_file(src_file, &buffer, &size)))) + if (pump) { - if (hresult) - *hresult = hr; + ID3DX10DataProcessor *processor; + ID3DX10DataLoader *loader; + + if (FAILED((hr = D3DX10CreateAsyncFileLoaderW(src_file, &loader)))) + return hr; + if (FAILED((hr = D3DX10CreateAsyncTextureProcessor(device, load_info, &processor)))) + { + ID3DX10DataLoader_Destroy(loader); + return hr; + } + if (FAILED((hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, hresult, (void **)texture)))) + { + ID3DX10DataLoader_Destroy(loader); + ID3DX10DataProcessor_Destroy(processor); + } return hr; }
- hr = D3DX10CreateTextureFromMemory(device, buffer, size, load_info, pump, texture, hresult); - - free(buffer); - + if (SUCCEEDED((hr = load_file(src_file, &buffer, &size)))) + { + hr = create_texture(device, buffer, size, load_info, texture); + free(buffer); + } + if (hresult) + *hresult = hr; return hr; }
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/texture.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index 31775fd6863..7a4031727fa 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -674,11 +674,32 @@ HRESULT WINAPI D3DX10CreateTextureFromResourceA(ID3D10Device *device, HMODULE mo if (!device) return E_INVALIDARG;
- hr = load_resourceA(module, resource, &buffer, &size); - if (FAILED(hr)) + if (pump) + { + ID3DX10DataProcessor *processor; + ID3DX10DataLoader *loader; + + if (FAILED((hr = D3DX10CreateAsyncResourceLoaderA(module, resource, &loader)))) + return hr; + if (FAILED((hr = D3DX10CreateAsyncTextureProcessor(device, load_info, &processor)))) + { + ID3DX10DataLoader_Destroy(loader); + return hr; + } + if (FAILED((hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, hresult, (void **)texture)))) + { + ID3DX10DataLoader_Destroy(loader); + ID3DX10DataProcessor_Destroy(processor); + } return hr; + }
- return D3DX10CreateTextureFromMemory(device, buffer, size, load_info, pump, texture, hresult); + if (FAILED((hr = load_resourceA(module, resource, &buffer, &size)))) + return hr; + hr = create_texture(device, buffer, size, load_info, texture); + if (hresult) + *hresult = hr; + return hr; }
HRESULT WINAPI D3DX10CreateTextureFromResourceW(ID3D10Device *device, HMODULE module, const WCHAR *resource,
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/texture.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index 7a4031727fa..a988df6f477 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -715,11 +715,32 @@ HRESULT WINAPI D3DX10CreateTextureFromResourceW(ID3D10Device *device, HMODULE mo if (!device) return E_INVALIDARG;
- hr = load_resourceW(module, resource, &buffer, &size); - if (FAILED(hr)) + if (pump) + { + ID3DX10DataProcessor *processor; + ID3DX10DataLoader *loader; + + if (FAILED((hr = D3DX10CreateAsyncResourceLoaderW(module, resource, &loader)))) + return hr; + if (FAILED((hr = D3DX10CreateAsyncTextureProcessor(device, load_info, &processor)))) + { + ID3DX10DataLoader_Destroy(loader); + return hr; + } + if (FAILED((hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, hresult, (void **)texture)))) + { + ID3DX10DataLoader_Destroy(loader); + ID3DX10DataProcessor_Destroy(processor); + } return hr; + }
- return D3DX10CreateTextureFromMemory(device, buffer, size, load_info, pump, texture, hresult); + if (FAILED((hr = load_resourceW(module, resource, &buffer, &size)))) + return hr; + hr = create_texture(device, buffer, size, load_info, texture); + if (hresult) + *hresult = hr; + return hr; }
void init_load_info(const D3DX10_IMAGE_LOAD_INFO *load_info, D3DX10_IMAGE_LOAD_INFO *out)
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/texture.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index a988df6f477..88efdf585b4 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -966,8 +966,26 @@ HRESULT WINAPI D3DX10CreateTextureFromMemory(ID3D10Device *device, const void *s return E_INVALIDARG; if (!src_data) return E_FAIL; + if (pump) - FIXME("Thread pump is not supported yet.\n"); + { + ID3DX10DataProcessor *processor; + ID3DX10DataLoader *loader; + + if (FAILED((hr = D3DX10CreateAsyncMemoryLoader(src_data, src_data_size, &loader)))) + return hr; + if (FAILED((hr = D3DX10CreateAsyncTextureProcessor(device, load_info, &processor)))) + { + ID3DX10DataLoader_Destroy(loader); + return hr; + } + if (FAILED((hr = ID3DX10ThreadPump_AddWorkItem(pump, loader, processor, hresult, (void **)texture)))) + { + ID3DX10DataLoader_Destroy(loader); + ID3DX10DataProcessor_Destroy(processor); + } + return hr; + }
hr = create_texture(device, src_data, src_data_size, load_info, texture); if (hresult)
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Piotr Caban piotr@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index d8839626c3b..1c28a62b700 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -848,7 +848,6 @@ static HRESULT WINAPI D3DX10ThreadPump_AddWorkItem(ID3DX10ThreadPump *iface, ID3 HRESULT hr;
ok(!add_work_item_count++, "unexpected call\n"); - ok(!object, "object = %p\n", object);
hr = ID3DX10DataLoader_Load(loader); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); @@ -2290,6 +2289,17 @@ static void test_create_texture(void) winetest_pop_context(); }
+ hr2 = 0xdeadbeef; + add_work_item_count = 0; + 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); + check_resource_info(resource, test_image, __LINE__); + check_resource_data(resource, test_image, __LINE__); + ID3D10Resource_Release(resource); + /* D3DX10CreateTextureFromFile tests */
hr2 = 0xdeadbeef;
This merge request was approved by Matteo Bruni.
Any particular reason the new test isn't inside the for loop right above so to check every test_image[] with the thread pump?