Changeset 73194 in vbox for trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
- Timestamp:
- Jul 18, 2018 7:14:24 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123797
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r71686 r73194 2349 2349 * @param cbGuestPitch The guest pitch. 2350 2350 * @param transfer The transfer direction. 2351 * @param pBox The box to copy .2351 * @param pBox The box to copy (clipped, valid, except for guest's srcx, srcy, srcz). 2352 2352 * @param pContext The context (for OpenGL). 2353 2353 * @param rc The current rc for all boxes. … … 2369 2369 { 2370 2370 uint32_t cbSurfacePitch; 2371 uint8_t *pDoubleBuffer , *pBufferStart;2372 u nsigned uDestOffset = 0;2371 uint8_t *pDoubleBuffer; 2372 uint32_t offHst; 2373 2373 2374 2374 pDoubleBuffer = (uint8_t *)RTMemAlloc(pMipLevel->cbSurface); … … 2403 2403 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 2404 2404 2405 uDestOffset = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2406 AssertReturnStmt( uDestOffset + pBox->w * pSurface->cbBlock + (pBox->h - 1) * pMipLevel->cbSurfacePitch 2407 <= pMipLevel->cbSurface, 2408 RTMemFree(pDoubleBuffer), 2409 VERR_INTERNAL_ERROR); 2410 2405 offHst = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2411 2406 cbSurfacePitch = pMipLevel->cbSurfacePitch; 2412 2407 … … 2417 2412 - cbSurfacePitch; /* flip image during copy */ 2418 2413 #else 2419 pBufferStart = pDoubleBuffer + uDestOffset;2420 2414 #endif 2421 2415 } 2422 2416 else 2423 2417 { 2418 /* The buffer will contain only the copied rectangle. */ 2419 offHst = 0; 2424 2420 cbSurfacePitch = pBox->w * pSurface->cbBlock; 2425 2421 #ifdef MANUAL_FLIP_SURFACE_DATA 2426 2422 pBufferStart = pDoubleBuffer + cbSurfacePitch * pBox->h - cbSurfacePitch; /* flip image during copy */ 2427 2423 #else 2428 pBufferStart = pDoubleBuffer; 2429 #endif 2430 } 2424 #endif 2425 } 2426 2427 uint32_t const offGst = pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch; /// @todo compressed fmts 2431 2428 2432 2429 rc = vmsvgaGMRTransfer(pThis, 2433 2430 transfer, 2434 pBufferStart, 2431 pDoubleBuffer, 2432 pMipLevel->cbSurface, 2433 offHst, 2435 2434 #ifdef MANUAL_FLIP_SURFACE_DATA 2436 2435 -(int32_t)cbSurfacePitch, 2437 2436 #else 2438 (int32_t)cbSurfacePitch,2437 cbSurfacePitch, 2439 2438 #endif 2440 2439 GuestPtr, 2441 pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch, /// @todo compressed fmts2440 offGst, 2442 2441 cbGuestPitch, 2443 2442 pBox->w * pSurface->cbBlock, … … 2498 2497 case SVGA3D_SURFACE_HINT_INDEXBUFFER: 2499 2498 { 2500 Assert(pBox->h == 1); 2499 /* Caller already clipped pBox and buffers are 1-dimensional. */ 2500 Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1); 2501 2501 2502 2502 VMSVGA3D_CLEAR_GL_ERRORS(); … … 2515 2515 ("cbStrictBufSize=%#x cbSurface=%#x pContext->id=%#x\n", (uint32_t)cbStrictBufSize, pMipLevel->cbSurface, pContext->id)); 2516 2516 #endif 2517 2518 unsigned offDst = pBox->x * pSurface->cbBlock + pBox->y * pMipLevel->cbSurfacePitch; 2519 if (RT_LIKELY( offDst + pBox->w * pSurface->cbBlock + (pBox->h - 1) * pMipLevel->cbSurfacePitch 2520 <= pMipLevel->cbSurface)) 2521 { 2522 Log(("Lock %s memory for rectangle (%d,%d)(%d,%d)\n", 2523 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_VERTEXBUFFER ? "vertex" : 2524 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_INDEXBUFFER ? "index" : "buffer", 2525 pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h)); 2526 2527 rc = vmsvgaGMRTransfer(pThis, 2528 transfer, 2529 pbData + offDst, 2530 pMipLevel->cbSurfacePitch, 2531 GuestPtr, 2532 pBox->srcx * pSurface->cbBlock + pBox->srcy * cbGuestPitch, 2533 cbGuestPitch, 2534 pBox->w * pSurface->cbBlock, 2535 pBox->h); 2536 AssertRC(rc); 2537 2538 Log4(("first line:\n%.*Rhxd\n", cbGuestPitch, pbData + offDst)); 2539 } 2540 else 2541 { 2542 AssertFailed(); 2543 rc = VERR_INTERNAL_ERROR; 2544 } 2517 Log(("Lock %s memory for rectangle (%d,%d)(%d,%d)\n", 2518 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_VERTEXBUFFER ? "vertex" : 2519 (pSurface->surfaceFlags & VMSVGA3D_SURFACE_HINT_SWITCH_MASK) == SVGA3D_SURFACE_HINT_INDEXBUFFER ? "index" : "buffer", 2520 pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h)); 2521 2522 uint32_t const offHst = pBox->x * pSurface->cbBlock; 2523 2524 rc = vmsvgaGMRTransfer(pThis, 2525 transfer, 2526 pbData, 2527 pMipLevel->cbSurface, 2528 offHst, 2529 pMipLevel->cbSurfacePitch, 2530 GuestPtr, 2531 pBox->srcx * pSurface->cbBlock, 2532 cbGuestPitch, 2533 pBox->w * pSurface->cbBlock, 2534 pBox->h); 2535 AssertRC(rc); 2536 2537 Log4(("first line:\n%.*Rhxd\n", cbGuestPitch, pbData + offHst)); 2545 2538 2546 2539 pState->ext.glUnmapBuffer(GL_ARRAY_BUFFER);
Note:
See TracChangeset
for help on using the changeset viewer.