From: Sebastian Mayr me@sam.st
In d3d8, setting the minification and magnifications filters to D3DTEXF_NONE does not yield an error when calling IDirect3DDevice8::ValidateDevice. Instead, it behaves identical to D3DTEXF_POINT. This resolves crashes and various visual glitches in Worms Blast.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54898 --- dlls/d3d8/directx.c | 2 +- dlls/wined3d/device.c | 19 +++++++++++-------- dlls/wined3d/sampler.c | 1 + include/wine/wined3d.h | 1 + 4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c index b35abc6b699..fed0e86b22e 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -476,7 +476,7 @@ BOOL d3d8_init(struct d3d8 *d3d8) DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | WINED3D_NO_PRIMITIVE_RESTART | WINED3D_LEGACY_CUBEMAP_FILTERING - | WINED3D_NO_DRAW_INDIRECT; + | WINED3D_NO_DRAW_INDIRECT | WINED3D_LEGACY_MINMAG_FILTERING; unsigned int adapter_idx, output_idx, adapter_count, output_count = 0; struct wined3d_adapter *wined3d_adapter;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index df186d9ffa2..5b54f4fc856 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4798,15 +4798,18 @@ HRESULT CDECL wined3d_device_validate_device(const struct wined3d_device *device
for (i = 0; i < WINED3D_MAX_COMBINED_SAMPLERS; ++i) { - if (state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] == WINED3D_TEXF_NONE) + if (!(device->wined3d->flags & WINED3D_LEGACY_MINMAG_FILTERING)) { - WARN("Sampler state %u has minfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); - return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; - } - if (state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] == WINED3D_TEXF_NONE) - { - WARN("Sampler state %u has magfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); - return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; + if (state->sampler_states[i][WINED3D_SAMP_MIN_FILTER] == WINED3D_TEXF_NONE) + { + WARN("Sampler state %u has minfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); + return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; + } + if (state->sampler_states[i][WINED3D_SAMP_MAG_FILTER] == WINED3D_TEXF_NONE) + { + WARN("Sampler state %u has magfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); + return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; + } }
texture = state->textures[i]; diff --git a/dlls/wined3d/sampler.c b/dlls/wined3d/sampler.c index d6e19fc521c..4ebc8c7f844 100644 --- a/dlls/wined3d/sampler.c +++ b/dlls/wined3d/sampler.c @@ -143,6 +143,7 @@ static VkFilter vk_filter_from_wined3d(enum wined3d_texture_filter_type f) { default: ERR("Invalid filter type %#x.\n", f); + case WINED3D_TEXF_NONE: case WINED3D_TEXF_POINT: return VK_FILTER_NEAREST; case WINED3D_TEXF_LINEAR: diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 71a5d92c301..e04aba2233f 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1324,6 +1324,7 @@ enum wined3d_memory_segment_group #define WINED3D_LEGACY_CUBEMAP_FILTERING 0x00001000 #define WINED3D_NORMALIZED_DEPTH_BIAS 0x00002000 #define WINED3D_NO_DRAW_INDIRECT 0x00004000 +#define WINED3D_LEGACY_MINMAG_FILTERING 0x00008000
#define WINED3D_RESZ_CODE 0x7fa05000