From: Connor McAdams <cmcadams@codeweavers.com> Signed-off-by: Connor McAdams <cmcadams@codeweavers.com> --- dlls/d3dx11_43/tests/d3dx11.c | 8 ----- dlls/d3dx11_43/texture.c | 56 +++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/dlls/d3dx11_43/tests/d3dx11.c b/dlls/d3dx11_43/tests/d3dx11.c index 0d39e6c079d..4801506b039 100644 --- a/dlls/d3dx11_43/tests/d3dx11.c +++ b/dlls/d3dx11_43/tests/d3dx11.c @@ -4084,14 +4084,6 @@ static void test_create_texture(void) winetest_pop_context(); } - if (!strcmp(winetest_platform, "wine")) - { - skip("Skipping D3DX11CreateTextureFromResource tests.\n"); - CoUninitialize(); - ok(!ID3D11Device_Release(device), "Unexpected refcount.\n"); - return; - } - /* D3DX11CreateTextureFromResource tests */ hr2 = 0xdeadbeef; diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c index 40e15993134..e3218e3ec04 100644 --- a/dlls/d3dx11_43/texture.c +++ b/dlls/d3dx11_43/texture.c @@ -676,31 +676,61 @@ HRESULT WINAPI D3DX11CreateTextureFromFileW(ID3D11Device *device, const WCHAR *s return hr; } -HRESULT WINAPI D3DX11CreateShaderResourceViewFromMemory(ID3D11Device *device, const void *data, - SIZE_T data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump, - ID3D11ShaderResourceView **view, HRESULT *hresult) -{ - FIXME("device %p, data %p, data_size %Iu, load_info %p, pump %p, view %p, hresult %p stub!\n", - device, data, data_size, load_info, pump, view, hresult); - - return E_NOTIMPL; -} - HRESULT WINAPI D3DX11CreateTextureFromResourceA(ID3D11Device *device, HMODULE module, const char *resource, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump, ID3D11Resource **texture, HRESULT *hresult) { - FIXME("device %p, module %p, resource %s, load_info %p, pump %p, texture %p, hresult %p stub!\n", + uint32_t size; + void *buffer; + HRESULT hr; + + TRACE("device %p, module %p, resource %s, load_info %p, pump %p, texture %p, hresult %p.\n", device, module, debugstr_a(resource), load_info, pump, texture, hresult); - return E_NOTIMPL; + if (!device) + return E_INVALIDARG; + + if (pump) + FIXME("D3DX11 thread pump is currently unimplemented.\n"); + + if (FAILED((hr = d3dx_load_resource_a(module, resource, &buffer, &size)))) + return hr; + hr = create_texture(device, buffer, size, load_info, texture); + if (hresult) + *hresult = hr; + return hr; } HRESULT WINAPI D3DX11CreateTextureFromResourceW(ID3D11Device *device, HMODULE module, const WCHAR *resource, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump, ID3D11Resource **texture, HRESULT *hresult) { - FIXME("device %p, module %p, resource %s, load_info %p, pump %p, texture %p, hresult %p stub!\n", + uint32_t size; + void *buffer; + HRESULT hr; + + TRACE("device %p, module %p, resource %s, load_info %p, pump %p, texture %p, hresult %p.\n", device, module, debugstr_w(resource), load_info, pump, texture, hresult); + if (!device) + return E_INVALIDARG; + + if (pump) + FIXME("D3DX11 thread pump is currently unimplemented.\n"); + + if (FAILED((hr = d3dx_load_resource_w(module, resource, &buffer, &size)))) + return hr; + hr = create_texture(device, buffer, size, load_info, texture); + if (hresult) + *hresult = hr; + return hr; +} + +HRESULT WINAPI D3DX11CreateShaderResourceViewFromMemory(ID3D11Device *device, const void *data, + SIZE_T data_size, D3DX11_IMAGE_LOAD_INFO *load_info, ID3DX11ThreadPump *pump, + ID3D11ShaderResourceView **view, HRESULT *hresult) +{ + FIXME("device %p, data %p, data_size %Iu, load_info %p, pump %p, view %p, hresult %p stub!\n", + device, data, data_size, load_info, pump, view, hresult); + return E_NOTIMPL; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9901