wined3d: Use the resource access flags in ffp_blit_supported().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-01-29 21:10:26 +03:30 committed by Alexandre Julliard
parent 36f20ec5d1
commit b7496ebacc

View File

@ -2664,18 +2664,19 @@ static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
HeapFree(GetProcessHeap(), 0, blitter); HeapFree(GetProcessHeap(), 0, blitter);
} }
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, static BOOL ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context,
const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op, const struct wined3d_resource *src_resource, DWORD src_location,
DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format, DWORD src_location, const struct wined3d_resource *dst_resource, DWORD dst_location)
DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format, DWORD dst_location)
{ {
const struct wined3d_format *src_format = src_resource->format;
const struct wined3d_format *dst_format = dst_resource->format;
BOOL decompress; BOOL decompress;
decompress = src_format && (src_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) 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); && !(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; return FALSE;
} }
@ -2690,14 +2691,14 @@ static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
switch (blit_op) switch (blit_op)
{ {
case WINED3D_BLIT_OP_COLOR_BLIT_CKEY: 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"); TRACE("Color keying requires converted textures.\n");
return FALSE; return FALSE;
} }
case WINED3D_BLIT_OP_COLOR_BLIT: case WINED3D_BLIT_OP_COLOR_BLIT:
case WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST: 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; return FALSE;
if (TRACE_ON(d3d)) 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"); TRACE("Can only blit to render targets.\n");
return FALSE; return FALSE;
@ -2821,9 +2822,7 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
dst_resource = &dst_texture->resource; dst_resource = &dst_texture->resource;
device = dst_resource->device; device = dst_resource->device;
if (!ffp_blit_supported(&device->adapter->gl_info, &device->adapter->d3d_info, op, if (!ffp_blit_supported(op, context, src_resource, src_location, dst_resource, dst_location))
src_resource->usage, src_resource->pool, src_resource->format, src_location,
dst_resource->usage, dst_resource->pool, dst_resource->format, dst_location))
{ {
if ((next = blitter->next)) if ((next = blitter->next))
return next->ops->blitter_blit(next, op, context, src_surface, src_location, return next->ops->blitter_blit(next, op, context, src_surface, src_location,