wined3d: Validate the filter in wined3d_texture_blt().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41929
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-03-16 21:05:35 +03:30 committed by Alexandre Julliard
parent ab0d8e6894
commit e9961039ec
3 changed files with 21 additions and 27 deletions

View File

@ -3917,24 +3917,24 @@ static void stretchrect_test(void)
{BACKBUFFER, &src_rect, TEX_RT_DST_640_480, &dst_rect_flipy, D3DTEXF_NONE}, {BACKBUFFER, &src_rect, TEX_RT_DST_640_480, &dst_rect_flipy, D3DTEXF_NONE},
/* Test filter. */ /* Test filter. */
{OFFSCREEN_64, NULL, OFFSCREEN_DST_64, NULL, D3DTEXF_NONE, TRUE}, {OFFSCREEN_64, NULL, OFFSCREEN_DST_64, NULL, D3DTEXF_NONE, TRUE},
{OFFSCREEN_64, NULL, OFFSCREEN_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {OFFSCREEN_64, NULL, OFFSCREEN_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_32, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE}, {OFFSCREEN_32, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE},
{OFFSCREEN_32, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {OFFSCREEN_32, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_PYRAMIDALQUAD, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_PYRAMIDALQUAD},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_GAUSSIANQUAD, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_GAUSSIANQUAD},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_CONVOLUTIONMONO, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_CONVOLUTIONMONO},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, 0xbadf, FALSE, TRUE}, {OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, 0xbadf},
{TEX_64, NULL, RT_DST_64, NULL, D3DTEXF_NONE, TRUE}, {TEX_64, NULL, RT_DST_64, NULL, D3DTEXF_NONE, TRUE},
{TEX_64, NULL, RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {TEX_64, NULL, RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{RT_64, NULL, RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {RT_64, NULL, RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{TEX_RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE}, {TEX_RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE},
{TEX_RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {TEX_RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE}, {RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_NONE, TRUE},
{RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {RT_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{BACKBUFFER, NULL, TEX_RT_DST_640_480, NULL, D3DTEXF_NONE, TRUE}, {BACKBUFFER, NULL, TEX_RT_DST_640_480, NULL, D3DTEXF_NONE, TRUE},
{BACKBUFFER, NULL, TEX_RT_DST_640_480, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE}, {BACKBUFFER, NULL, TEX_RT_DST_640_480, NULL, D3DTEXF_ANISOTROPIC},
}; };
window = create_window(); window = create_window();

View File

@ -165,20 +165,10 @@ void texture2d_blt_fbo(struct wined3d_device *device, struct wined3d_context *co
&& (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top) && (abs(src_rect->bottom - src_rect->top) != abs(dst_rect->bottom - dst_rect->top)
|| abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left)); || abs(src_rect->right - src_rect->left) != abs(dst_rect->right - dst_rect->left));
switch (filter) if (filter == WINED3D_TEXF_LINEAR)
{ gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR;
case WINED3D_TEXF_LINEAR: else
gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR; gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST;
break;
default:
FIXME("Unsupported filter mode %s (%#x).\n", debug_d3dtexturefiltertype(filter), filter);
/* fall through */
case WINED3D_TEXF_NONE:
case WINED3D_TEXF_POINT:
gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST;
break;
}
/* Make sure the locations are up-to-date. Loading the destination /* Make sure the locations are up-to-date. Loading the destination
* surface isn't required if the entire surface is overwritten. (And is * surface isn't required if the entire surface is overwritten. (And is

View File

@ -3569,6 +3569,10 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|| src_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D) || src_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
if (filter != WINED3D_TEXF_NONE && filter != WINED3D_TEXF_POINT
&& filter != WINED3D_TEXF_LINEAR)
return WINED3DERR_INVALIDCALL;
dst_format_flags = dst_texture->resource.format_flags; dst_format_flags = dst_texture->resource.format_flags;
if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture, if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture,
dst_sub_resource_idx % dst_texture->level_count, &dst_box))) dst_sub_resource_idx % dst_texture->level_count, &dst_box)))