From: Henri Verbeet hverbeet@locutus.nl
The documentation suggests this isn't a valid combination, but it works anyway. --- dlls/d3d11/tests/d3d11.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index fce02156b65..c3b65a82372 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -5465,6 +5465,16 @@ static void test_create_sampler_state(void) refcount = ID3D11SamplerState_Release(sampler_state1); ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
+ desc.Filter = D3D11_FILTER_ANISOTROPIC; + desc.MaxAnisotropy = 0; + hr = ID3D11Device_CreateSamplerState(device, &desc, &sampler_state1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ID3D11SamplerState_GetDesc(sampler_state1, &desc); + ok(desc.Filter == D3D11_FILTER_ANISOTROPIC, "Got filter %#x.\n", desc.Filter); + ok(!desc.MaxAnisotropy, "Got max anisotropy %u.\n", desc.MaxAnisotropy); + refcount = ID3D11SamplerState_Release(sampler_state1); + ok(!refcount, "Got refcount %lu.\n", refcount); + for (i = 0; i < ARRAY_SIZE(desc_conversion_tests); ++i) { const struct test *current = &desc_conversion_tests[i];
From: Henri Verbeet hverbeet@locutus.nl
--- dlls/d3d10core/tests/d3d10core.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index f1504a1b815..4df8b7d7cbf 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -4152,6 +4152,16 @@ static void test_create_sampler_state(void) refcount = ID3D10SamplerState_Release(sampler_state1); ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
+ desc.Filter = D3D10_FILTER_ANISOTROPIC; + desc.MaxAnisotropy = 0; + hr = ID3D10Device_CreateSamplerState(device, &desc, &sampler_state1); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ID3D10SamplerState_GetDesc(sampler_state1, &desc); + ok(desc.Filter == D3D10_FILTER_ANISOTROPIC, "Got filter %#x.\n", desc.Filter); + ok(!desc.MaxAnisotropy, "Got max anisotropy %u.\n", desc.MaxAnisotropy); + refcount = ID3D10SamplerState_Release(sampler_state1); + ok(!refcount, "Got refcount %lu.\n", refcount); + hr = ID3D10Device_QueryInterface(device, &IID_ID3D11Device, (void **)&d3d11_device); ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, "Device should implement ID3D11Device.\n");
From: Henri Verbeet hverbeet@locutus.nl
It's not a meaningful combination. Additionally, on the OpenGL side it is an error to set TEXTURE_MAX_ANISOTROPY to a value less than 1.0, and Vulkan's VUID-VkSamplerCreateInfo-anisotropyEnable-01071 imposes a similar restriction.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57946 --- dlls/d3d11/state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/state.c b/dlls/d3d11/state.c index 981f8ab51bf..8818cb6a827 100644 --- a/dlls/d3d11/state.c +++ b/dlls/d3d11/state.c @@ -1616,7 +1616,10 @@ static HRESULT d3d_sampler_state_init(struct d3d_sampler_state *state, struct d3 wined3d_desc.min_lod = desc->MinLOD; wined3d_desc.max_lod = max(desc->MinLOD, desc->MaxLOD); wined3d_desc.mip_base_level = 0; - wined3d_desc.max_anisotropy = D3D11_DECODE_IS_ANISOTROPIC_FILTER(desc->Filter) ? desc->MaxAnisotropy : 1; + if (D3D11_DECODE_IS_ANISOTROPIC_FILTER(desc->Filter) && desc->MaxAnisotropy) + wined3d_desc.max_anisotropy = desc->MaxAnisotropy; + else + wined3d_desc.max_anisotropy = 1; wined3d_desc.compare = wined3d_texture_compare_from_d3d11(desc->Filter); wined3d_desc.comparison_func = wined3d_cmp_func_from_d3d11(desc->ComparisonFunc); wined3d_desc.srgb_decode = TRUE;
From: Henri Verbeet hverbeet@locutus.nl
--- dlls/wined3d/stateblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 5803f166955..08fe65817ec 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -2884,7 +2884,7 @@ static void sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc, desc->mip_base_level = min(max(sampler_states[WINED3D_SAMP_MAX_MIP_LEVEL], texture->lod), texture->level_count - 1);
desc->max_anisotropy = sampler_states[WINED3D_SAMP_MAX_ANISOTROPY]; - if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC + if (!desc->max_anisotropy || (sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC && sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC && sampler_states[WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_ANISOTROPIC) || (texture->flags & WINED3D_TEXTURE_COND_NP2))