From: Connor McAdams cmcadams@codeweavers.com
Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/d3dx10_43/tests/d3dx10.c | 130 +++++++++++++++++++++++++++++++--- dlls/d3dx10_43/texture.c | 4 +- 2 files changed, 122 insertions(+), 12 deletions(-)
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index af080f8ff7e..45220a51f27 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -3025,6 +3025,12 @@ static void test_D3DX10CreateAsyncTextureInfoProcessor(void) CoUninitialize(); }
+static const D3DX10_IMAGE_LOAD_INFO d3dx10_default_load_info = +{ + D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, + D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, D3DX10_DEFAULT, NULL +}; + static void test_D3DX10CreateAsyncTextureProcessor(void) { ID3DX10DataProcessor *dp; @@ -3059,6 +3065,9 @@ static void test_D3DX10CreateAsyncTextureProcessor(void)
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { + D3DX10_IMAGE_LOAD_INFO load_info = d3dx10_default_load_info; + D3DX10_IMAGE_INFO info = { 0 }; + winetest_push_context("Test %u", i);
hr = D3DX10CreateAsyncTextureProcessor(device, NULL, &dp); @@ -3079,6 +3088,27 @@ static void test_D3DX10CreateAsyncTextureProcessor(void) hr = ID3DX10DataProcessor_Destroy(dp); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ /* Check that D3DX10_IMAGE_INFO argument is set. */ + load_info.pSrcInfo = &info; + hr = D3DX10CreateAsyncTextureProcessor(device, &load_info, &dp); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + 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 %#lx.\n", hr); + if (hr == S_OK) + { + hr = ID3DX10DataProcessor_CreateDeviceObject(dp, (void **)&resource); + 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__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + + hr = ID3DX10DataProcessor_Destroy(dp); + ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + winetest_pop_context(); }
@@ -4213,6 +4243,8 @@ static void test_create_texture(void)
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { + D3DX10_IMAGE_INFO info = { 0 }; + winetest_push_context("Test %u", i);
hr2 = 0xdeadbeef; @@ -4227,6 +4259,22 @@ static void test_create_texture(void) ID3D10Resource_Release(resource); }
+ /* Check that D3DX10_IMAGE_INFO argument is set. */ + load_info = d3dx10_default_load_info; + load_info.pSrcInfo = &info; + hr2 = 0xdeadbeef; + hr = D3DX10CreateTextureFromMemory(device, test_image[i].data, test_image[i].size, &load_info, NULL, &resource, &hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); + ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + check_resource_info(resource, test_image + i, __LINE__); + check_resource_data(resource, test_image + i, __LINE__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + winetest_pop_context(); }
@@ -4297,11 +4345,8 @@ static void test_create_texture(void) hr = D3DX10CreateTextureFromMemory(device, dds_24bit_8_8, sizeof(dds_24bit_8_8), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - if (img_info.Width) - { - check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, - D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3DX10_IFF_DDS, FALSE); - } + check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, + D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3DX10_IFF_DDS, FALSE);
hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&tex_2d); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); @@ -4336,11 +4381,8 @@ static void test_create_texture(void) hr = D3DX10CreateTextureFromMemory(device, dds_24bit_8_8, sizeof(dds_24bit_8_8), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); - if (img_info.Width) - { - check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, - D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3DX10_IFF_DDS, FALSE); - } + check_image_info_values(&img_info, 8, 8, 1, 1, 4, 0, DXGI_FORMAT_R8G8B8A8_UNORM, + D3D10_RESOURCE_DIMENSION_TEXTURE2D, D3DX10_IFF_DDS, FALSE);
hr = ID3D10Resource_QueryInterface(resource, &IID_ID3D10Texture2D, (void **)&tex_2d); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); @@ -4389,6 +4431,8 @@ static void test_create_texture(void)
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { + D3DX10_IMAGE_INFO info = { 0 }; + winetest_push_context("Test %u", i); create_file(test_filename, test_image[i].data, test_image[i].size, path);
@@ -4416,6 +4460,37 @@ static void test_create_texture(void) ID3D10Resource_Release(resource); }
+ /* Check that D3DX10_IMAGE_INFO argument is set. */ + load_info = d3dx10_default_load_info; + load_info.pSrcInfo = &info; + hr2 = 0xdeadbeef; + hr = D3DX10CreateTextureFromFileW(device, path, &load_info, NULL, &resource, &hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); + ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + check_resource_info(resource, test_image + i, __LINE__); + check_resource_data(resource, test_image + i, __LINE__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + + load_info = d3dx10_default_load_info; + load_info.pSrcInfo = &info; + hr2 = 0xdeadbeef; + hr = D3DX10CreateTextureFromFileA(device, get_str_a(path), &load_info, NULL, &resource, &hr2); + ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); + ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "Got unexpected hr %#lx.\n", hr); + if (hr == S_OK) + { + check_resource_info(resource, test_image + i, __LINE__); + check_resource_data(resource, test_image + i, __LINE__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + delete_file(test_filename); winetest_pop_context(); } @@ -4466,6 +4541,8 @@ static void test_create_texture(void)
for (i = 0; i < ARRAY_SIZE(test_image); ++i) { + D3DX10_IMAGE_INFO info = { 0 }; + winetest_push_context("Test %u", i); resource_module = create_resource_module(test_resource_name, test_image[i].data, test_image[i].size);
@@ -4500,6 +4577,39 @@ static void test_create_texture(void) ID3D10Resource_Release(resource); }
+ /* Check that D3DX10_IMAGE_INFO argument is set. */ + load_info = d3dx10_default_load_info; + load_info.pSrcInfo = &info; + hr2 = 0xdeadbeef; + hr = D3DX10CreateTextureFromResourceW(device, resource_module, + test_resource_name, &load_info, NULL, &resource, &hr2); + ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "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__); + check_resource_data(resource, test_image + i, __LINE__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + + load_info = d3dx10_default_load_info; + load_info.pSrcInfo = &info; + hr2 = 0xdeadbeef; + hr = D3DX10CreateTextureFromResourceA(device, resource_module, + get_str_a(test_resource_name), &load_info, NULL, &resource, &hr2); + ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP), + "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__); + check_resource_data(resource, test_image + i, __LINE__); + check_image_info(&info, test_image + i, __LINE__); + ID3D10Resource_Release(resource); + } + delete_resource_module(test_resource_name, resource_module); winetest_pop_context(); } diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index 85459cc9a56..46dd323239e 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -668,8 +668,6 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO FIXME("load_info->Filter is ignored.\n"); if (load_info->MipFilter != D3DX10_DEFAULT) FIXME("load_info->MipFilter is ignored.\n"); - if (load_info->pSrcInfo) - FIXME("load_info->pSrcInfo is ignored.\n");
*resource_data = NULL; hr = d3dx_image_init(data, size, &image, 0, D3DX_IMAGE_SUPPORT_DXT10); @@ -764,6 +762,8 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO load_info->Usage = D3D10_USAGE_DEFAULT; load_info->BindFlags = D3D10_BIND_SHADER_RESOURCE; load_info->MiscFlags = img_info.MiscFlags; + if (load_info->pSrcInfo) + *load_info->pSrcInfo = img_info;
res_data = NULL;