[PATCH 1/5] wined3d: Use the correct texture coordinates in swapchain_blit() in the non-glBlitFramebuffer, NP2 case.

Henri Verbeet hverbeet at gmail.com
Tue Jul 7 09:58:47 CDT 2015


On 6 July 2015 at 22:20, Matteo Bruni <mbruni at codeweavers.com> wrote:
> diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
> index 146f5d6..141abc2 100644
> --- a/dlls/wined3d/swapchain.c
> +++ b/dlls/wined3d/swapchain.c
> @@ -280,21 +280,21 @@ HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *s
>
>  /* A GL context is provided by the caller */
>  static void swapchain_blit(const struct wined3d_swapchain *swapchain,
> -        struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect)
> +        struct wined3d_context *context, unsigned int src_w, unsigned int src_h,
> +        const RECT *src_rect, const RECT *dst_rect)
>  {
>      struct wined3d_surface *backbuffer = surface_from_resource(
>              wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0));
> -    UINT src_w = src_rect->right - src_rect->left;
> -    UINT src_h = src_rect->bottom - src_rect->top;
>      GLenum gl_filter;
>      const struct wined3d_gl_info *gl_info = context->gl_info;
>      RECT win_rect;
>      UINT win_h;
>
> -    TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s.\n",
> -            swapchain, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect));
> +    TRACE("swapchain %p, context %p, src_w %u, src_h %u, src_rect %s, dst_rect %s.\n",
> +            swapchain, context, src_w, src_h, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect));
>
> -    if (src_w == dst_rect->right - dst_rect->left && src_h == dst_rect->bottom - dst_rect->top)
> +    if (src_rect->right - src_rect->left == dst_rect->right - dst_rect->left
> +            && src_rect->bottom - src_rect->top == dst_rect->bottom - dst_rect->top)
>          gl_filter = GL_NEAREST;
>      else
>          gl_filter = GL_LINEAR;
> @@ -528,7 +528,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
>          if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP && !once++)
>              FIXME("WINED3D_SWAP_EFFECT_FLIP not implemented.\n");
>
> -        swapchain_blit(swapchain, context, &src_rect, &dst_rect);
> +        swapchain_blit(swapchain, context, back_buffer->pow2Width, back_buffer->pow2Height, &src_rect, &dst_rect);
>      }
>
>      if (swapchain->num_contexts > 1)
I may be missing something subtle here, but wouldn't it be better to
just replace src_w/wrc_h with
backbuffer->pow2Width/backbuffer->powe2Height in the "if
(backbuffer->container->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)"
block that scales the texture coordinates?



More information about the wine-devel mailing list