Re: [PATCH 1/5] wined3d: Use the correct texture coordinates in swapchain_blit() in the non-glBlitFramebuffer, NP2 case.
On 6 July 2015 at 22:20, Matteo Bruni <mbruni(a)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?
2015-07-07 16:58 GMT+02:00 Henri Verbeet <hverbeet(a)gmail.com>:
On 6 July 2015 at 22:20, Matteo Bruni <mbruni(a)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?
Yes... I guess that's what happens when you modify your patch a number of times without stopping a moment to see the whole picture.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-07-07 um 18:33 schrieb Matteo Bruni:
Yes... I guess that's what happens when you modify your patch a number of times without stopping a moment to see the whole picture. Just fyi, I'll replace swapchain_blit with a wined3d_surface_blt call soonish. Of course that doesn't mean we shouldn't fix this bug in the meantime :-) .
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVnDlrAAoJEN0/YqbEcdMwq3AP/0mA5LLs3nQSuAXjDiBenQPs R1aCoTZWxOs17OmeaifC+rYxLI25LUBDOLxP/0d998NKCfgd7UTTxcaMQy15iHgz p6rv/CTcpE86lllDn3jq2InHs/DQ62MJMeaKj8Ha/tFsufnZBfyrvFWkgyILPTcS t/QAneWQiyyuFxl0Fg3GNr4k3cEasHn3sNvxfOGs0++2JXEDUkXfu2RL80rdhvyA 0XKHQHeeQ4yQTwj8cwVSVVS2oRILPB03bNyhw58dJRoXFvX6xPSEjWwL61SoucsD P81hctS+MwvN/o0Pvs0qJSioeD6jOdCDobkmKGPEaYM04pVk2P1DAIMq3r8nW1dR 0pfHvt/EVFNZsfFKfPsAnFliyOx3WLCf6GFoFg6y0HiTl1nuNckqHFPQq+IoYUnp wKFX9IZRX6bVhh8Q1UsypjTZX7tytDYeA1e2HFdZ0hBmh1MzUeFLQftHM2esHYwB 46vkzHEJCPZzYs49t0d08bCLMgyjc+ZtQmwiWvThvtzFvQdiOqQ+yjiFeFlC/8Kz 4F29Ld5rmSJdCwXk+PlDFWHjrIvFfNV5Jn0yurt4OP8a2UbWi7iKMK4KGg94RXff dJ781/DjBkd1LDiNXc162fsgj6ni8JAeMighJiHsUZV078/qItC3KsBWHaw3iI2U AeeM89PrxKE1KCnTTQjM =e5+8 -----END PGP SIGNATURE-----
2015-07-07 22:41 GMT+02:00 Stefan Dösinger <stefandoesinger(a)gmail.com>:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 2015-07-07 um 18:33 schrieb Matteo Bruni:
Yes... I guess that's what happens when you modify your patch a number of times without stopping a moment to see the whole picture. Just fyi, I'll replace swapchain_blit with a wined3d_surface_blt call soonish. Of course that doesn't mean we shouldn't fix this bug in the meantime :-) .
Yeah, that's the "proper fix" and it's going to be needed for core profiles. Looking forward to it ;)
participants (3)
-
Henri Verbeet -
Matteo Bruni -
Stefan Dösinger