Ticket #54570: fix-flicker.patch

File fix-flicker.patch, 3.8 KB (added by casr (Chris Rawnsley), 7 years ago)
  • dlls/wined3d/context.c

    # Patch to fix flickering in full screen. Patch from
    # https://raw.githubusercontent.com/Homebrew/formula-patches/74c2566/wine/2.14.patch
    # See: https://bugs.winehq.org/show_bug.cgi?id=34166
    
    old new  
    14311431}
    14321432
    14331433/* This function takes care of wined3d pixel format selection. */
    1434 static int context_choose_pixel_format(const struct wined3d_device *device, HDC hdc,
    1435         const struct wined3d_format *color_format, const struct wined3d_format *ds_format,
    1436         BOOL auxBuffers)
     1434static int context_choose_pixel_format(const struct wined3d_device *device, const struct wined3d_swapchain *swapchain,
     1435        HDC hdc, const struct wined3d_format *color_format, const struct wined3d_format *ds_format,
     1436        BOOL auxBuffers)
    14371437{
    14381438    unsigned int cfg_count = device->adapter->cfg_count;
    14391439    unsigned int current_value;
    14401440    PIXELFORMATDESCRIPTOR pfd;
    14411441    int iPixelFormat = 0;
     1442    BOOL double_buffer = TRUE;
    14421443    unsigned int i;
    14431444
    14441445    TRACE("device %p, dc %p, color_format %s, ds_format %s, aux_buffers %#x.\n",
    14451446            device, hdc, debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id),
    14461447            auxBuffers);
    14471448
     1449        if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && !swapchain->desc.backbuffer_count)
     1450        double_buffer = FALSE;
     1451
    14481452    current_value = 0;
    14491453    for (i = 0; i < cfg_count; ++i)
    14501454    {
     
    14561460        if (cfg->iPixelType != WGL_TYPE_RGBA_ARB)
    14571461            continue;
    14581462        /* In window mode we need a window drawable format and double buffering. */
    1459         if (!(cfg->windowDrawable && cfg->doubleBuffer))
     1463        if (!cfg->windowDrawable || (double_buffer && !cfg->doubleBuffer))
    14601464            continue;
    14611465        if (cfg->redSize < color_format->red_size)
    14621466            continue;
     
    14791483         * depth it is no problem to emulate 16-bit using e.g. 24-bit, so accept that. */
    14801484        if (cfg->depthSize == ds_format->depth_size)
    14811485            value += 1;
    1482         if (cfg->stencilSize == ds_format->stencil_size)
     1486        if (!cfg->doubleBuffer == !double_buffer)
    14831487            value += 2;
    1484         if (cfg->alphaSize == color_format->alpha_size)
     1488        if (cfg->stencilSize == ds_format->stencil_size)
    14851489            value += 4;
     1490        if (cfg->alphaSize == color_format->alpha_size)
     1491            value += 8;
    14861492        /* We like to have aux buffers in backbuffer mode */
    14871493        if (auxBuffers && cfg->auxBuffers)
    1488             value += 8;
     1494            value += 16;
    14891495        if (cfg->redSize == color_format->red_size
    14901496                && cfg->greenSize == color_format->green_size
    14911497                && cfg->blueSize == color_format->blue_size)
    1492             value += 16;
     1498            value += 32;
    14931499
    14941500        if (value > current_value)
    14951501        {
     
    15051511        memset(&pfd, 0, sizeof(pfd));
    15061512        pfd.nSize      = sizeof(pfd);
    15071513        pfd.nVersion   = 1;
    1508         pfd.dwFlags    = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW;/*PFD_GENERIC_ACCELERATED*/
     1514        pfd.dwFlags    = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;/*PFD_GENERIC_ACCELERATED*/
     1515        if (double_buffer)
     1516                pfd.dwFlags |= PFD_DOUBLEBUFFER;
    15091517        pfd.iPixelType = PFD_TYPE_RGBA;
    15101518        pfd.cAlphaBits = color_format->alpha_size;
    15111519        pfd.cColorBits = color_format->red_size + color_format->green_size
     
    17771785    }
    17781786
    17791787    /* Try to find a pixel format which matches our requirements. */
    1780     if (!(ret->pixel_format = context_choose_pixel_format(device, ret->hdc, color_format, ds_format, auxBuffers)))
     1788    if (!(ret->pixel_format = context_choose_pixel_format(device, swapchain, ret->hdc, color_format, ds_format, auxBuffers)))
    17811789        goto out;
    17821790
    17831791    ret->gl_info = gl_info;