From b7496ebacc300bed45d8449bab3815617bb1d383 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 29 Jan 2018 21:10:26 +0330 Subject: [PATCH] wined3d: Use the resource access flags in ffp_blit_supported(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/surface.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index fb28117d641..520f88ca8e0 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -2664,18 +2664,19 @@ static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_ HeapFree(GetProcessHeap(), 0, blitter); } -static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, - const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op, - DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format, DWORD src_location, - DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format, DWORD dst_location) +static BOOL ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context, + const struct wined3d_resource *src_resource, DWORD src_location, + const struct wined3d_resource *dst_resource, DWORD dst_location) { + const struct wined3d_format *src_format = src_resource->format; + const struct wined3d_format *dst_format = dst_resource->format; BOOL decompress; decompress = src_format && (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) && !(dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED); - if (!decompress && (src_pool == WINED3D_POOL_SYSTEM_MEM || dst_pool == WINED3D_POOL_SYSTEM_MEM)) + if (!decompress && !(src_resource->access & dst_resource->access & WINED3D_RESOURCE_ACCESS_GPU)) { - TRACE("Source or destination is in system memory.\n"); + TRACE("Source or destination resource is not GPU accessible.\n"); return FALSE; } @@ -2690,14 +2691,14 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, switch (blit_op) { case WINED3D_BLIT_OP_COLOR_BLIT_CKEY: - if (d3d_info->shader_color_key) + if (context->d3d_info->shader_color_key) { TRACE("Color keying requires converted textures.\n"); return FALSE; } case WINED3D_BLIT_OP_COLOR_BLIT: case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST: - if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) + if (!context->gl_info->supported[WINED3D_GL_LEGACY_CONTEXT]) return FALSE; if (TRACE_ON(d3d)) @@ -2722,7 +2723,7 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, } } - if (!(dst_usage & WINED3DUSAGE_RENDERTARGET)) + if (!(dst_resource->usage & WINED3DUSAGE_RENDERTARGET)) { TRACE("Can only blit to render targets.\n"); return FALSE; @@ -2821,9 +2822,7 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit dst_resource = &dst_texture->resource; device = dst_resource->device; - if (!ffp_blit_supported(&device->adapter->gl_info, &device->adapter->d3d_info, op, - src_resource->usage, src_resource->pool, src_resource->format, src_location, - dst_resource->usage, dst_resource->pool, dst_resource->format, dst_location)) + if (!ffp_blit_supported(op, context, src_resource, src_location, dst_resource, dst_location)) { if ((next = blitter->next)) return next->ops->blitter_blit(next, op, context, src_surface, src_location,