From ecbc1cb6238a198410cca05145677e520e7f6c18 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 13 Apr 2017 00:10:58 +0200 Subject: [PATCH] wined3d: Use the "arbfp" blitter for P8 and YUV blits. This fixes a regression introduced by commit cad4badbcf25992e0c61521aa15e639c2611f5d6. In particular, before that commit, surface_load_drawable() would always use the device blitter, without checking whether that blitter claims to support the blit in question. As it turns out, the FBO blitter claims to support them, and the arbfp blitter claims not to support them. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/arb_program_shader.c | 11 ++++++----- dlls/wined3d/surface.c | 31 ++++++++++++++++--------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 5a7a5c93f58..caa0d69d339 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -7707,8 +7707,8 @@ static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info) static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info, enum wined3d_blit_op blit_op, - enum wined3d_pool src_pool, const struct wined3d_format *src_format, - enum wined3d_pool dst_pool, const struct wined3d_format *dst_format) + enum wined3d_pool src_pool, const struct wined3d_format *src_format, DWORD src_location, + enum wined3d_pool dst_pool, const struct wined3d_format *dst_format, DWORD dst_location) { enum complex_fixup src_fixup; BOOL decompress; @@ -7746,7 +7746,8 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, dump_color_fixup_desc(src_format->color_fixup); } - if (!is_identity_fixup(dst_format->color_fixup)) + if (!is_identity_fixup(dst_format->color_fixup) + && (dst_format->id != src_format->id || dst_location != WINED3D_LOCATION_DRAWABLE)) { TRACE("Destination fixups are not supported\n"); return FALSE; @@ -7796,8 +7797,8 @@ static void arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli RECT s, d; if (!arbfp_blit_supported(&device->adapter->gl_info, &device->adapter->d3d_info, op, - src_texture->resource.pool, src_texture->resource.format, - dst_texture->resource.pool, dst_texture->resource.format)) + src_texture->resource.pool, src_texture->resource.format, src_location, + dst_texture->resource.pool, dst_texture->resource.format, dst_location)) { if ((next = blitter->next)) next->ops->blitter_blit(next, op, context, src_surface, src_location, diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 2bf48545116..fdf9e27e58f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -485,8 +485,8 @@ static void surface_blt_fbo(const struct wined3d_device *device, } static BOOL fbo_blitter_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, - DWORD src_usage, enum wined3d_pool src_pool, const struct wined3d_format *src_format, - DWORD dst_usage, enum wined3d_pool dst_pool, const struct wined3d_format *dst_format) + 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) { if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) return FALSE; @@ -504,9 +504,8 @@ static BOOL fbo_blitter_supported(const struct wined3d_gl_info *gl_info, enum wi if (!((dst_format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (dst_usage & WINED3DUSAGE_RENDERTARGET))) return FALSE; - if (!(src_format->id == dst_format->id - || (is_identity_fixup(src_format->color_fixup) - && is_identity_fixup(dst_format->color_fixup)))) + if ((src_format->id != dst_format->id || dst_location == WINED3D_LOCATION_DRAWABLE) + && (!is_identity_fixup(src_format->color_fixup) || !is_identity_fixup(dst_format->color_fixup))) return FALSE; break; @@ -2184,8 +2183,10 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, if (!depth && sub_resource->locations & (WINED3D_LOCATION_TEXTURE_SRGB | WINED3D_LOCATION_TEXTURE_RGB) && (texture->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB) && fbo_blitter_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, - texture->resource.usage, texture->resource.pool, texture->resource.format, - texture->resource.usage, texture->resource.pool, texture->resource.format)) + texture->resource.usage, texture->resource.pool, + texture->resource.format, WINED3D_LOCATION_TEXTURE_RGB, + texture->resource.usage, texture->resource.pool, + texture->resource.format, WINED3D_LOCATION_TEXTURE_SRGB)) { if (srgb) surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, WINED3D_LOCATION_TEXTURE_RGB, @@ -2198,17 +2199,17 @@ static BOOL surface_load_texture(struct wined3d_surface *surface, } if (!depth && sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED) - && (!srgb || (texture->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB)) - && fbo_blitter_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, - texture->resource.usage, texture->resource.pool, texture->resource.format, - texture->resource.usage, texture->resource.pool, texture->resource.format)) + && (!srgb || (texture->resource.format_flags & WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB))) { DWORD src_location = sub_resource->locations & WINED3D_LOCATION_RB_RESOLVED ? WINED3D_LOCATION_RB_RESOLVED : WINED3D_LOCATION_RB_MULTISAMPLE; DWORD dst_location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB; - surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, src_location, - &src_rect, surface, dst_location, &src_rect); + if (fbo_blitter_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, + texture->resource.usage, texture->resource.pool, texture->resource.format, src_location, + texture->resource.usage, texture->resource.pool, texture->resource.format, dst_location)) + surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, src_location, + &src_rect, surface, dst_location, &src_rect); return TRUE; } @@ -2412,8 +2413,8 @@ static void fbo_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit_ struct wined3d_blitter *next; if (!fbo_blitter_supported(&device->adapter->gl_info, op, - src_resource->usage, src_resource->pool, src_resource->format, - src_resource->usage, dst_resource->pool, dst_resource->format)) + src_resource->usage, src_resource->pool, src_resource->format, src_location, + src_resource->usage, dst_resource->pool, dst_resource->format, dst_location)) { if ((next = blitter->next)) next->ops->blitter_blit(next, op, context, src_surface, src_location,