[PATCH 1/3] d3dx10: Implement D3DX10CreateTextureFromMemory initially.
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> --- dlls/d3dx10_43/d3dx10_43_main.c | 11 -- dlls/d3dx10_43/tests/d3dx10.c | 7 +- dlls/d3dx10_43/texture.c | 233 ++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+), 15 deletions(-)
On Fri, Jun 18, 2021 at 8:29 AM Ziqing Hui <zhui(a)codeweavers.com> wrote:
Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com> --- dlls/d3dx10_43/d3dx10_43_main.c | 11 -- dlls/d3dx10_43/tests/d3dx10.c | 7 +- dlls/d3dx10_43/texture.c | 233 ++++++++++++++++++++++++++++++++ 3 files changed, 236 insertions(+), 15 deletions(-)
hr = D3DX10GetImageInfoFromMemory(src_data, src_data_size, NULL, &img_info, NULL); if (FAILED(hr)) return E_FAIL;
You can put the function call into the if to make it more compact (and follow more closely our current style), such as: if (FAILED(D3DX10GetImageInfoFromMemory(src_data, src_data_size, NULL, &img_info, NULL))) return E_FAIL; Similarly below.
+ WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
I don't know WIC particularly well but it seems prudent to me to check the return value of this function call.
+ hr = ID3D10Device_CreateTexture2D(device, &texture_2d_desc, NULL, &texture_2d); + if (FAILED(hr)) + goto end; + ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)texture_2d, 0, NULL, buffer, stride, frame_size);
I think you can pass the texture data directly to CreateTexture2D() here, avoiding the separate UpdateSubresource().
+ *texture = (ID3D10Resource *)texture_2d;
I wonder if that is supposed to be set to NULL on failure. Can you please add a test for that?
+ if (hr != S_OK) + return E_FAIL; + return S_OK;
Is this necessary? As opposed to a simple "return hr;".
+ *texture = (ID3D10Resource *)texture_2d; I wonder if that is supposed to be set to NULL on failure. Can you please add a test for that? OK, I'll add more test for that. + if (hr != S_OK) + return E_FAIL; + return S_OK; Is this necessary? As opposed to a simple "return hr;". The tests show that D3DX10CreateTextureFromMemory will always return E_FAIL on failure. See: https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/d3dx10_43/tests/d3dx1...
On Thu, Jun 24, 2021 at 5:43 AM Ziqing Hui <zhui(a)codeweavers.com> wrote:
+ *texture = (ID3D10Resource *)texture_2d; I wonder if that is supposed to be set to NULL on failure. Can you please add a test for that? OK, I'll add more test for that. + if (hr != S_OK) + return E_FAIL; + return S_OK; Is this necessary? As opposed to a simple "return hr;". The tests show that D3DX10CreateTextureFromMemory will always return E_FAIL on failure. See: https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/d3dx10_43/tests/d3dx1...
The current tests still pass for me with just "return hr;".
participants (2)
-
Matteo Bruni -
Ziqing Hui