Commit e9961039 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Validate the filter in wined3d_texture_blt().

parent ab0d8e68
......@@ -3917,24 +3917,24 @@ static void stretchrect_test(void)
{BACKBUFFER, &src_rect, TEX_RT_DST_640_480, &dst_rect_flipy, D3DTEXF_NONE},
/* Test filter. */
{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_ANISOTROPIC, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_PYRAMIDALQUAD, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_GAUSSIANQUAD, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_CONVOLUTIONMONO, FALSE, TRUE},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, 0xbadf, FALSE, TRUE},
{OFFSCREEN_32, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_PYRAMIDALQUAD},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_GAUSSIANQUAD},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_ANISOTROPIC},
{OFFSCREEN_64, NULL, TEX_RT_DST_64, NULL, D3DTEXF_CONVOLUTIONMONO},
{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_ANISOTROPIC, FALSE, TRUE},
{RT_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},
{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_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_ANISOTROPIC, FALSE, TRUE},
{BACKBUFFER, NULL, TEX_RT_DST_640_480, NULL, D3DTEXF_ANISOTROPIC},
};
window = create_window();
......@@ -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->right - src_rect->left) != abs(dst_rect->right - dst_rect->left));
switch (filter)
{
case WINED3D_TEXF_LINEAR:
gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR;
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;
}
if (filter == WINED3D_TEXF_LINEAR)
gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_NICEST_EXT : GL_LINEAR;
else
gl_filter = scaled_resolve ? GL_SCALED_RESOLVE_FASTEST_EXT : GL_NEAREST;
/* Make sure the locations are up-to-date. Loading the destination
* surface isn't required if the entire surface is overwritten. (And is
......
......@@ -3569,6 +3569,10 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|| src_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
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;
if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture,
dst_sub_resource_idx % dst_texture->level_count, &dst_box)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment