VirtualBox

Changeset 81576 in vbox for trunk


Ignore:
Timestamp:
Oct 29, 2019 10:34:03 PM (5 years ago)
Author:
vboxsync
Message:

Additions/3D/mesa: Deal with the coordinate system differences between the D3D state tracker and the SVGA driver. bugref:8893

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/3D/mesa/mesa-17.3.9/src/gallium/state_trackers/nine/nine_state.c

    r79768 r81576  
    13511351    blit.scissor_enable = FALSE;
    13521352
     1353#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     1354    /* Flip Y because the state tracker uses the D3D texture coords:
     1355     * top,left=0,0; bottom,right = 1,1.
     1356     * While the blit draws a quad using the source as texture and sets
     1357     * the texcoords for destination vertices using the OpenGL coordinates:
     1358     * bottom,left = 0,0; top,right = 1,1.
     1359     */
     1360    {
     1361        struct pipe_blit_info b = blit;
     1362
     1363        b.dst.box.y = b.dst.resource->height0 - b.dst.box.y - b.dst.box.height;
     1364
     1365        b.src.box.y = b.src.resource->height0 - b.src.box.y;
     1366        b.src.box.height = -b.src.box.height;
     1367
     1368        context->pipe->blit(context->pipe, &b);
     1369    }
     1370#else
    13531371    context->pipe->blit(context->pipe, &blit);
     1372#endif
    13541373}
    13551374
     
    24992518
    25002519            DBG("Clearing (%u..%u)x(%u..%u)\n", x1, x2, y1, y2);
     2520#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     2521            /* Flip Y because the nine state tracker uses the D3D coords:
     2522             * top,left=0,0; bottom,right = 1,1.
     2523             * While the clear_render_target draws a quad and sets the texcoords
     2524             * for the destination vertices using the OpenGL coordinates:
     2525             * bottom,left = 0,0; top,right = 1,1.
     2526             */
     2527            unsigned const height = y2 - y1;
     2528            y1 = cbuf->height - y1 - height;
     2529            pipe->clear_render_target(pipe, cbuf, &rgba,
     2530                                      x1, y1, x2 - x1, height, false);
     2531#else
    25012532            pipe->clear_render_target(pipe, cbuf, &rgba,
    25022533                                      x1, y1, x2 - x1, y2 - y1, false);
     2534#endif
    25032535        }
    25042536    }
     
    25262558        zsbuf = NineSurface9_GetSurface(zsbuf_surf, 0);
    25272559        assert(zsbuf);
     2560
     2561#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     2562        /* Flip Y because the nine state tracker uses the D3D coords:
     2563         * top,left=0,0; bottom,right = 1,1.
     2564         * While the clear_depth_stencil draws a quad and sets the texcoords
     2565         * for the destination vertices using the OpenGL coordinates:
     2566         * bottom,left = 0,0; top,right = 1,1.
     2567         */
     2568        unsigned const height = y2 - y1;
     2569        y1 = zsbuf->height - y1 - height;
     2570        pipe->clear_depth_stencil(pipe, zsbuf, bufs, Z, Stencil,
     2571                                  x1, y1, x2 - x1, height, false);
     2572#else
    25282573        pipe->clear_depth_stencil(pipe, zsbuf, bufs, Z, Stencil,
    25292574                                  x1, y1, x2 - x1, y2 - y1, false);
     2575#endif
    25302576    }
    25312577    return;
     
    26672713    (void) src;
    26682714
     2715#ifdef VBOX_WITH_MESA3D_NINE_SVGA
     2716    /* This seems to work correctly and does not require Y flip. */
     2717#endif
    26692718    context->pipe->resource_copy_region(context->pipe,
    26702719            dst_res, dst_level,
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette