From: Connor McAdams <cmcadams@codeweavers.com> Signed-off-by: Connor McAdams <cmcadams@codeweavers.com> --- dlls/d3dx10_43/tests/d3dx10.c | 10 +++++----- dlls/d3dx10_43/texture.c | 25 +++++++++++++++++-------- dlls/d3dx11_43/tests/d3dx11.c | 10 +++++----- dlls/d3dx11_43/texture.c | 25 +++++++++++++++++-------- 4 files changed, 44 insertions(+), 26 deletions(-) diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c index 5a22240d37b..c35351a2301 100644 --- a/dlls/d3dx10_43/tests/d3dx10.c +++ b/dlls/d3dx10_43/tests/d3dx10.c @@ -5081,7 +5081,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromMemory(device, test->data, test->size, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -5282,7 +5282,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileW(device, path, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -5292,7 +5292,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX10CreateTextureFromFileA(device, get_str_a(path), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -5403,7 +5403,7 @@ static void test_create_texture(void) hr = D3DX10CreateTextureFromResourceW(device, resource_module, test_resource_name, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -5414,7 +5414,7 @@ static void test_create_texture(void) hr = D3DX10CreateTextureFromResourceA(device, resource_module, get_str_a(test_resource_name), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); diff --git a/dlls/d3dx10_43/texture.c b/dlls/d3dx10_43/texture.c index aa173e3f004..bb312ae42ff 100644 --- a/dlls/d3dx10_43/texture.c +++ b/dlls/d3dx10_43/texture.c @@ -649,14 +649,6 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO return E_FAIL; *resource_data = NULL; - if (!load_info->Filter || load_info->Filter == D3DX10_DEFAULT) - load_info->Filter = D3DX10_FILTER_LINEAR; - if (FAILED(hr = d3dx_validate_filter(load_info->Filter))) - { - WARN("Invalid filter argument %#x.\n", load_info->Filter); - return hr; - } - hr = d3dx_image_init(data, size, &image, 0, D3DX_IMAGE_SUPPORT_DXT10); if (FAILED(hr)) return E_FAIL; @@ -710,6 +702,23 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX10_IMAGE_LOAD_INFO load_info->MipLevels = (load_info->MipLevels == D3DX10_FROM_FILE) ? img_info.MipLevels : max_mip_level_count; load_info->MipLevels = min(max_mip_level_count, load_info->MipLevels); + if ((load_info->Width != image.size.width) || (load_info->Height != image.size.height) + || (load_info->Depth != image.size.depth) || (load_info->MipLevels != image.mip_levels) + || (fmt_desc->format != image.format)) + { + if (!load_info->Filter || load_info->Filter == D3DX10_DEFAULT) + load_info->Filter = D3DX10_FILTER_LINEAR; + if (FAILED(hr = d3dx_validate_filter(load_info->Filter))) + { + WARN("Invalid filter argument %#x.\n", load_info->Filter); + goto end; + } + } + else + { + load_info->Filter = D3DX10_FILTER_NONE; + } + hr = d3dx_create_subresource_data_for_texture(load_info->Width, load_info->Height, load_info->Depth, load_info->MipLevels, img_info.ArraySize, fmt_desc, &sub_rsrcs); if (FAILED(hr)) diff --git a/dlls/d3dx11_43/tests/d3dx11.c b/dlls/d3dx11_43/tests/d3dx11.c index 30efd8a341e..5bdfb0de976 100644 --- a/dlls/d3dx11_43/tests/d3dx11.c +++ b/dlls/d3dx11_43/tests/d3dx11.c @@ -3905,7 +3905,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX11CreateTextureFromMemory(device, test->data, test->size, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -4100,7 +4100,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX11CreateTextureFromFileW(device, path, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -4110,7 +4110,7 @@ static void test_create_texture(void) hr2 = 0xdeadbeef; hr = D3DX11CreateTextureFromFileA(device, get_str_a(path), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -4221,7 +4221,7 @@ static void test_create_texture(void) hr = D3DX11CreateTextureFromResourceW(device, resource_module, test_resource_name, &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); @@ -4232,7 +4232,7 @@ static void test_create_texture(void) hr = D3DX11CreateTextureFromResourceA(device, resource_module, get_str_a(test_resource_name), &load_info, NULL, &resource, &hr2); ok(hr == hr2, "Got unexpected hr2 %#lx.\n", hr2); - todo_wine_if(i == 2) ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); + ok(hr == test->expected_hr, "Got unexpected hr %#lx.\n", hr); if (SUCCEEDED(hr)) { check_test_image_load_info_resource(resource, test); diff --git a/dlls/d3dx11_43/texture.c b/dlls/d3dx11_43/texture.c index e3218e3ec04..21f5b008964 100644 --- a/dlls/d3dx11_43/texture.c +++ b/dlls/d3dx11_43/texture.c @@ -384,14 +384,6 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX11_IMAGE_LOAD_INFO return E_FAIL; *resource_data = NULL; - if (!load_info->Filter || load_info->Filter == D3DX11_DEFAULT) - load_info->Filter = D3DX11_FILTER_LINEAR; - if (FAILED(hr = d3dx_validate_filter(load_info->Filter))) - { - WARN("Invalid filter argument %#x.\n", load_info->Filter); - return hr; - } - hr = d3dx_image_init(data, size, &image, 0, D3DX_IMAGE_SUPPORT_DXT10); if (FAILED(hr)) return E_FAIL; @@ -445,6 +437,23 @@ HRESULT load_texture_data(const void *data, SIZE_T size, D3DX11_IMAGE_LOAD_INFO load_info->MipLevels = (load_info->MipLevels == D3DX11_FROM_FILE) ? img_info.MipLevels : max_mip_level_count; load_info->MipLevels = min(max_mip_level_count, load_info->MipLevels); + if ((load_info->Width != image.size.width) || (load_info->Height != image.size.height) + || (load_info->Depth != image.size.depth) || (load_info->MipLevels != image.mip_levels) + || (fmt_desc->format != image.format)) + { + if (!load_info->Filter || load_info->Filter == D3DX11_DEFAULT) + load_info->Filter = D3DX11_FILTER_LINEAR; + if (FAILED(hr = d3dx_validate_filter(load_info->Filter))) + { + WARN("Invalid filter argument %#x.\n", load_info->Filter); + goto end; + } + } + else + { + load_info->Filter = D3DX11_FILTER_NONE; + } + hr = d3dx_create_subresource_data_for_texture(load_info->Width, load_info->Height, load_info->Depth, load_info->MipLevels, img_info.ArraySize, fmt_desc, &sub_rsrcs); if (FAILED(hr)) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10513