Changeset 57082 in vbox for trunk/src/VBox
- Timestamp:
- Jul 26, 2015 8:45:54 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r57081 r57082 2619 2619 2620 2620 Log(("vmsvga3dSurfaceDefine: sid=%x surfaceFlags=%x format=%s (%x) multiSampleCount=%d autogenFilter=%d, cMipLevels=%d size=(%d,%d,%d)\n", 2621 sid, surfaceFlags, vmsvga SurfaceType2String(format), format, multisampleCount, autogenFilter, cMipLevels, pMipLevelSize->width, pMipLevelSize->height, pMipLevelSize->depth));2621 sid, surfaceFlags, vmsvgaLookupEnum((int)format, &g_SVGA3dSurfaceFormat2String), format, multisampleCount, autogenFilter, cMipLevels, pMipLevelSize->width, pMipLevelSize->height, pMipLevelSize->depth)); 2622 2622 2623 2623 AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp
r57081 r57082 55 55 static LONG WINAPI vmsvga3dWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 56 56 #endif 57 58 59 /********************************************************************************************************************************* 60 * Global Variables * 61 *********************************************************************************************************************************/ 62 /** Enum value to string mappings for SVGA3dSurfaceFormat, prefix "SVGA3D_". */ 63 static const VMSVGAINFOENUM g_aSVGA3dSurfaceFormats[] = 64 { 65 { SVGA3D_FORMAT_INVALID , "FORMAT_INVALID" }, 66 { SVGA3D_X8R8G8B8 , "X8R8G8B8" }, 67 { SVGA3D_A8R8G8B8 , "A8R8G8B8" }, 68 { SVGA3D_R5G6B5 , "R5G6B5" }, 69 { SVGA3D_X1R5G5B5 , "X1R5G5B5" }, 70 { SVGA3D_A1R5G5B5 , "A1R5G5B5" }, 71 { SVGA3D_A4R4G4B4 , "A4R4G4B4" }, 72 { SVGA3D_Z_D32 , "Z_D32" }, 73 { SVGA3D_Z_D16 , "Z_D16" }, 74 { SVGA3D_Z_D24S8 , "Z_D24S8" }, 75 { SVGA3D_Z_D15S1 , "Z_D15S1" }, 76 { SVGA3D_LUMINANCE8 , "LUMINANCE8" }, 77 { SVGA3D_LUMINANCE4_ALPHA4 , "LUMINANCE4_ALPHA4" }, 78 { SVGA3D_LUMINANCE16 , "LUMINANCE16" }, 79 { SVGA3D_LUMINANCE8_ALPHA8 , "LUMINANCE8_ALPHA8" }, 80 { SVGA3D_DXT1 , "DXT1" }, 81 { SVGA3D_DXT2 , "DXT2" }, 82 { SVGA3D_DXT3 , "DXT3" }, 83 { SVGA3D_DXT4 , "DXT4" }, 84 { SVGA3D_DXT5 , "DXT5" }, 85 { SVGA3D_BUMPU8V8 , "BUMPU8V8" }, 86 { SVGA3D_BUMPL6V5U5 , "BUMPL6V5U5" }, 87 { SVGA3D_BUMPX8L8V8U8 , "BUMPX8L8V8U8" }, 88 { SVGA3D_BUMPL8V8U8 , "BUMPL8V8U8" }, 89 { SVGA3D_ARGB_S10E5 , "ARGB_S10E5" }, 90 { SVGA3D_ARGB_S23E8 , "ARGB_S23E8" }, 91 { SVGA3D_A2R10G10B10 , "A2R10G10B10" }, 92 { SVGA3D_V8U8 , "V8U8" }, 93 { SVGA3D_Q8W8V8U8 , "Q8W8V8U8" }, 94 { SVGA3D_CxV8U8 , "CxV8U8" }, 95 { SVGA3D_X8L8V8U8 , "X8L8V8U8" }, 96 { SVGA3D_A2W10V10U10 , "A2W10V10U10" }, 97 { SVGA3D_ALPHA8 , "ALPHA8" }, 98 { SVGA3D_R_S10E5 , "R_S10E5" }, 99 { SVGA3D_R_S23E8 , "R_S23E8" }, 100 { SVGA3D_RG_S10E5 , "RG_S10E5" }, 101 { SVGA3D_RG_S23E8 , "RG_S23E8" }, 102 { SVGA3D_BUFFER , "BUFFER" }, 103 { SVGA3D_Z_D24X8 , "Z_D24X8" }, 104 { SVGA3D_V16U16 , "V16U16" }, 105 { SVGA3D_G16R16 , "G16R16" }, 106 { SVGA3D_A16B16G16R16 , "A16B16G16R16" }, 107 { SVGA3D_UYVY , "UYVY" }, 108 { SVGA3D_YUY2 , "YUY2" }, 109 { SVGA3D_NV12 , "NV12" }, 110 { SVGA3D_AYUV , "AYUV" }, 111 { SVGA3D_BC4_UNORM , "BC4_UNORM" }, 112 { SVGA3D_BC5_UNORM , "BC5_UNORM" }, 113 { SVGA3D_Z_DF16 , "Z_DF16" }, 114 { SVGA3D_Z_DF24 , "Z_DF24" }, 115 { SVGA3D_Z_D24S8_INT , "Z_D24S8_INT" }, 116 }; 117 VMSVGAINFOENUMMAP_MAKE(RT_NOTHING, g_SVGA3dSurfaceFormat2String, g_aSVGA3dSurfaceFormats, "SVGA3D_"); 118 57 119 58 120 #ifdef RT_OS_WINDOWS … … 356 418 357 419 /** 420 * Looks up an enum value in a translation table. 421 * 422 * @returns The value name. 423 * @param iValue The value to name. 424 * @param pEnumMap Enum value to string mapping. 425 */ 426 const char *vmsvgaLookupEnum(int32_t iValue, PCVMSVGAINFOENUMMAP pEnumMap) 427 { 428 PCVMSVGAINFOENUM paValues = pEnumMap->paValues; 429 430 #ifdef VBOX_STRICT 431 /* 432 * Check that it's really sorted, or the binary lookup won't work right. 433 */ 434 if (!*pEnumMap->pfAsserted) 435 { 436 *pEnumMap->pfAsserted = true; 437 for (uint32_t i = 1; i < pEnumMap->cValues; i++) 438 Assert(paValues[i - 1].iValue <= paValues[i].iValue); 439 } 440 #endif 441 442 /* 443 * Binary search 444 */ 445 uint32_t iStart = 0; 446 uint32_t iEnd = pEnumMap->cValues; 447 for (;;) 448 { 449 uint32_t i = iStart + (iEnd - iStart) / 2; 450 if (iValue < paValues[i].iValue) 451 { 452 if (i > iStart) 453 iEnd = i; 454 else 455 break; 456 } 457 else if (iValue > paValues[i].iValue) 458 { 459 i++; 460 if (i < iEnd) 461 iStart = i; 462 else 463 break; 464 } 465 else 466 return paValues[i].pszName; 467 } 468 return NULL; 469 } 470 471 472 /** 358 473 * Formats an enum value as a string, sparse mapping table. 359 474 * … … 363 478 * @param pszName The variable name, optional. 364 479 * @param iValue The enum value. 365 * @param pszPrefix The prefix of the enum values. Empty string if 366 * none. This helps reduce the memory footprint 367 * as well as the source code size. 368 * @param papszValues One to one string mapping of the enum values. 369 * @param cValues The number of values in the mapping. 480 * @param fPrefix Whether to prepend the prefix or not. 481 * @param pEnumMap Enum value to string mapping. 370 482 */ 371 483 char *vmsvgaFormatEnumValueEx(char *pszBuffer, size_t cbBuffer, const char *pszName, int32_t iValue, 372 const char *pszPrefix, PCVMSVGAINFOENUM paValues, size_t cValues) 373 { 374 for (uint32_t i = 0; i < cValues; i++) 375 if (paValues[i].iValue == iValue) 376 { 377 if (pszName) 378 RTStrPrintf(pszBuffer, cbBuffer, "%s = %s%s (%#x)", pszName, pszPrefix, paValues[i].pszName, iValue); 379 else 380 RTStrPrintf(pszBuffer, cbBuffer, "%s%s (%#x)", pszPrefix, paValues[i].pszName, iValue); 381 return pszBuffer; 382 } 484 bool fPrefix, PCVMSVGAINFOENUMMAP pEnumMap) 485 { 486 const char *pszValueName = vmsvgaLookupEnum(iValue, pEnumMap); 487 const char *pszPrefix = fPrefix ? pEnumMap->pszPrefix : ""; 488 if (pszValueName) 489 { 490 if (pszName) 491 RTStrPrintf(pszBuffer, cbBuffer, "%s = %s%s (%#x)", pszName, pszPrefix, pszValueName, iValue); 492 else 493 RTStrPrintf(pszBuffer, cbBuffer, "%s%s (%#x)", pszPrefix, pszValueName, iValue); 494 return pszBuffer; 495 } 383 496 384 497 if (pszName) … … 475 588 case SVGA3D_BUFFER: 476 589 return; 590 default: 591 break; /* ok */ 477 592 } 478 593 … … 519 634 * Color to 8-bit grayscale conversion is done by averaging. 520 635 */ 521 #define CONVERT_SCANLINE(a_ AddExpr) \636 #define CONVERT_SCANLINE(a_RdExpr, a_AddExpr) \ 522 637 do { \ 523 638 for (uint32_t xSrc = 0, xDst = 0, cxLeftInChar = cxPerChar; xSrc < cx; xSrc++) \ 524 639 { \ 640 a_RdExpr; \ 525 641 pauScanline[xDst] += (a_AddExpr) & 0xff; \ 526 642 Assert(pauScanline[xDst] <= cPixelsWeightPerChar); \ … … 533 649 } while (0) 534 650 535 uint32_t u32Tmp;536 651 switch (enmFormat) 537 652 { … … 539 654 case SVGA3D_X8R8G8B8: 540 655 case SVGA3D_A8R8G8B8: 541 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu32[xSrc]) & 0xff) /* B */ 542 + ((u32Tmp >> 8) & 0xff) /* G */ 543 + ((u32Tmp >> 16) & 0xff) /* R */) / 3); 656 CONVERT_SCANLINE(uint32_t const u32Tmp = uSrc.pu32[xSrc], 657 ( ( u32Tmp & 0xff) /* B */ 658 + ((u32Tmp >> 8) & 0xff) /* G */ 659 + ((u32Tmp >> 16) & 0xff) /* R */) / 3); 544 660 break; 545 661 case SVGA3D_R5G6B5: 546 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0x1f) * 8 547 + ((uSrc.pu16[xSrc] >> 5) & 0x3f) * 4 548 + ( uSrc.pu16[xSrc] >> 11) * 8 ) / 3 ); 662 CONVERT_SCANLINE(uint16_t const u16Tmp = uSrc.pu16[xSrc], 663 ( ( u16Tmp & 0x1f) * 8 664 + ((u16Tmp >> 5) & 0x3f) * 4 665 + ( u16Tmp >> 11) * 8 ) / 3 ); 549 666 break; 550 667 case SVGA3D_X1R5G5B5: 551 668 case SVGA3D_A1R5G5B5: 552 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0x1f) * 8 553 + ((uSrc.pu16[xSrc] >> 5) & 0x1f) * 8 554 + ((uSrc.pu16[xSrc] >> 10) & 0x1f) * 8) / 3 ); 669 CONVERT_SCANLINE(uint16_t const u16Tmp = uSrc.pu16[xSrc], 670 ( ( u16Tmp & 0x1f) * 8 671 + ((u16Tmp >> 5) & 0x1f) * 8 672 + ((u16Tmp >> 10) & 0x1f) * 8) / 3 ); 555 673 break; 556 674 case SVGA3D_A4R4G4B4: 557 CONVERT_SCANLINE( ( ( uSrc.pu16[xSrc] & 0xf) * 16 558 + ((uSrc.pu16[xSrc] >> 4) & 0xf) * 16 559 + ((uSrc.pu16[xSrc] >> 8) & 0xf) * 16) / 3 ); 675 CONVERT_SCANLINE(uint16_t const u16Tmp = uSrc.pu16[xSrc], 676 ( ( u16Tmp & 0xf) * 16 677 + ((u16Tmp >> 4) & 0xf) * 16 678 + ((u16Tmp >> 8) & 0xf) * 16) / 3 ); 560 679 break; 561 680 case SVGA3D_A16B16G16R16: 562 CONVERT_SCANLINE( ( ((uSrc.pu64[xSrc] >> 8) & 0xff) /* R */ 563 + ((uSrc.pu64[xSrc] >> 24) & 0xff) /* G */ 564 + ((uSrc.pu64[xSrc] >> 40) & 0xff) /* B */ ) / 3); 681 CONVERT_SCANLINE(uint64_t const u64Tmp = uSrc.pu64[xSrc], 682 ( ((u64Tmp >> 8) & 0xff) /* R */ 683 + ((u64Tmp >> 24) & 0xff) /* G */ 684 + ((u64Tmp >> 40) & 0xff) /* B */ ) / 3); 565 685 break; 566 686 case SVGA3D_A2R10G10B10: 567 CONVERT_SCANLINE( ( ((uSrc.pu32[xSrc] ) & 0x3ff) /* B */ 568 + ((uSrc.pu32[xSrc] >> 10) & 0x3ff) /* G */ 569 + ((uSrc.pu32[xSrc] >> 20) & 0x3ff) /* R */ ) / (3 * 4)); 687 CONVERT_SCANLINE(uint32_t const u32Tmp = uSrc.pu32[xSrc], 688 ( ( u32Tmp & 0x3ff) /* B */ 689 + ((u32Tmp >> 10) & 0x3ff) /* G */ 690 + ((u32Tmp >> 20) & 0x3ff) /* R */ ) / (3 * 4)); 570 691 break; 571 692 case SVGA3D_G16R16: 572 CONVERT_SCANLINE( ( (uSrc.pu32[xSrc] & 0xffff) /* R */ 573 + (uSrc.pu32[xSrc] >> 16 ) /* G */) / 0x200); 693 CONVERT_SCANLINE(uint32_t const u32Tmp = uSrc.pu32[xSrc], 694 ( (u32Tmp & 0xffff) /* R */ 695 + (u32Tmp >> 16 ) /* G */) / 0x200); 574 696 break; 575 697 576 698 /* Depth. */ 577 699 case SVGA3D_Z_D32: 578 CONVERT_SCANLINE( (((u32Tmp = ~(( uSrc.pu32[xSrc] >> 1) | uSrc.pu32[xSrc]) & UINT32_C(0x44444444)) >> 2) & 1) 700 CONVERT_SCANLINE(uint32_t const u32Tmp = ~((uSrc.pu32[xSrc] >> 1) | uSrc.pu32[xSrc]) & UINT32_C(0x44444444), 701 (( u32Tmp >> (2 - 0)) & RT_BIT_32(0)) 579 702 | ((u32Tmp >> ( 6 - 1)) & RT_BIT_32(1)) 580 703 | ((u32Tmp >> (10 - 2)) & RT_BIT_32(2)) … … 586 709 break; 587 710 case SVGA3D_Z_D16: 588 CONVERT_SCANLINE( (((u32Tmp = ~uSrc.pu16[xSrc]) >> 1) & 1) 589 | ((u32Tmp >> ( 3 - 1)) & RT_BIT_32(1)) 590 | ((u32Tmp >> ( 5 - 2)) & RT_BIT_32(2)) 591 | ((u32Tmp >> ( 7 - 3)) & RT_BIT_32(3)) 592 | ((u32Tmp >> ( 9 - 4)) & RT_BIT_32(4)) 593 | ((u32Tmp >> (11 - 5)) & RT_BIT_32(5)) 594 | ((u32Tmp >> (13 - 6)) & RT_BIT_32(6)) 595 | ((u32Tmp >> (15 - 7)) & RT_BIT_32(7)) ); 711 CONVERT_SCANLINE(uint16_t const u16Tmp = ~uSrc.pu16[xSrc], 712 ((u16Tmp >> ( 1 - 0)) & RT_BIT_32(0)) 713 | ((u16Tmp >> ( 3 - 1)) & RT_BIT_32(1)) 714 | ((u16Tmp >> ( 5 - 2)) & RT_BIT_32(2)) 715 | ((u16Tmp >> ( 7 - 3)) & RT_BIT_32(3)) 716 | ((u16Tmp >> ( 9 - 4)) & RT_BIT_32(4)) 717 | ((u16Tmp >> (11 - 5)) & RT_BIT_32(5)) 718 | ((u16Tmp >> (13 - 6)) & RT_BIT_32(6)) 719 | ((u16Tmp >> (15 - 7)) & RT_BIT_32(7)) ); 596 720 break; 597 721 case SVGA3D_Z_D24S8: 598 CONVERT_SCANLINE( ((u32Tmp = uSrc.pu16[xSrc]) & 0xff) /* stencile */ 722 CONVERT_SCANLINE(uint32_t const u32Tmp = uSrc.pu32[xSrc], 723 ( u32Tmp & 0xff) /* stencile */ 599 724 | ((~u32Tmp >> 18) & 0x3f)); 600 725 break; 601 726 case SVGA3D_Z_D15S1: 602 CONVERT_SCANLINE( (((u32Tmp = uSrc.pu16[xSrc]) & 0x01) << 7) /* stencile */ 603 | ((~u32Tmp >> 8) & 0x7f)); 727 CONVERT_SCANLINE(uint16_t const u16Tmp = uSrc.pu16[xSrc], 728 ( (u16Tmp & 0x01) << 7) /* stencile */ 729 | ((~u16Tmp >> 8) & 0x7f)); 604 730 break; 605 731 606 732 /* Pure alpha. */ 607 733 case SVGA3D_ALPHA8: 608 CONVERT_SCANLINE( uSrc.pu8[xSrc]);734 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu8[xSrc]); 609 735 break; 610 736 611 737 /* Luminance */ 612 738 case SVGA3D_LUMINANCE8: 613 CONVERT_SCANLINE( uSrc.pu8[xSrc]);739 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu8[xSrc]); 614 740 break; 615 741 case SVGA3D_LUMINANCE4_ALPHA4: 616 CONVERT_SCANLINE( uSrc.pu8[xSrc] & 0xf0);742 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu8[xSrc] & 0xf0); 617 743 break; 618 744 case SVGA3D_LUMINANCE16: 619 CONVERT_SCANLINE( uSrc.pu16[xSrc] >> 8);745 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu16[xSrc] >> 8); 620 746 break; 621 747 case SVGA3D_LUMINANCE8_ALPHA8: 622 CONVERT_SCANLINE( uSrc.pu16[xSrc] >> 8);748 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu16[xSrc] >> 8); 623 749 break; 624 750 … … 661 787 if (!fHitFormatAssert) 662 788 { 663 AssertMsgFailed(("%s is not implemented\n", vmsvga SurfaceType2String(enmFormat)));789 AssertMsgFailed(("%s is not implemented\n", vmsvgaLookupEnum((int)enmFormat, &g_SVGA3dSurfaceFormat2String))); 664 790 fHitFormatAssert = true; 665 791 } … … 668 794 /* Lazy programmer fallbacks. */ 669 795 if (cbSrcPixel == 4) 670 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu32[xSrc]) & 0xff) 671 + ((u32Tmp >> 8) & 0xff) 672 + ((u32Tmp >> 16) & 0xff) 673 + ((u32Tmp >> 24) & 0xff) ) / 4); 796 CONVERT_SCANLINE(uint32_t const u32Tmp = uSrc.pu32[xSrc], 797 ( ( u32Tmp & 0xff) 798 + ((u32Tmp >> 8) & 0xff) 799 + ((u32Tmp >> 16) & 0xff) 800 + ((u32Tmp >> 24) & 0xff) ) / 4); 674 801 else if (cbSrcPixel == 3) 675 CONVERT_SCANLINE( ( (uint32_t)uSrc.pu8[xSrc * 4] 676 + (uint32_t)uSrc.pu8[xSrc * 4 + 1] 677 + (uint32_t)uSrc.pu8[xSrc * 4 + 2] ) / 3); 802 CONVERT_SCANLINE(RT_NOTHING, 803 ( (uint32_t)uSrc.pu8[xSrc * 4] 804 + (uint32_t)uSrc.pu8[xSrc * 4 + 1] 805 + (uint32_t)uSrc.pu8[xSrc * 4 + 2] ) / 3); 678 806 else if (cbSrcPixel == 2) 679 CONVERT_SCANLINE( ( ((u32Tmp = uSrc.pu16[xSrc]) & 0xf) * 16 680 + ((u32Tmp >> 4) & 0xf) * 16 681 + ((u32Tmp >> 8) & 0xf) * 16 682 + ((u32Tmp >> 12) & 0xf) * 16 ) / 4); 807 CONVERT_SCANLINE(uint16_t const u16Tmp = uSrc.pu16[xSrc], 808 ( ( u16Tmp & 0xf) 809 + ((u16Tmp >> 4) & 0xf) 810 + ((u16Tmp >> 8) & 0xf) 811 + ((u16Tmp >> 12) & 0xf) ) * 4 /* mul 16 div 4 */ ); 683 812 else if (cbSrcPixel == 1) 684 CONVERT_SCANLINE( uSrc.pu8[xSrc]);813 CONVERT_SCANLINE(RT_NOTHING, uSrc.pu8[xSrc]); 685 814 else 686 815 AssertFailed(); … … 1840 1969 } 1841 1970 1842 const char *vmsvgaSurfaceType2String(SVGA3dSurfaceFormat format)1843 {1844 switch (format)1845 {1846 case SVGA3D_X8R8G8B8:1847 return "SVGA3D_X8R8G8B8";1848 case SVGA3D_A8R8G8B8:1849 return "SVGA3D_A8R8G8B8";1850 case SVGA3D_R5G6B5:1851 return "SVGA3D_R5G6B5";1852 case SVGA3D_X1R5G5B5:1853 return "SVGA3D_X1R5G5B5";1854 case SVGA3D_A1R5G5B5:1855 return "SVGA3D_A1R5G5B5";1856 case SVGA3D_A4R4G4B4:1857 return "SVGA3D_A4R4G4B4";1858 case SVGA3D_Z_D32:1859 return "SVGA3D_Z_D32";1860 case SVGA3D_Z_D16:1861 return "SVGA3D_Z_D16";1862 case SVGA3D_Z_D24S8:1863 return "SVGA3D_Z_D24S8";1864 case SVGA3D_Z_D15S1:1865 return "SVGA3D_Z_D15S1";1866 case SVGA3D_Z_D24X8:1867 return "SVGA3D_Z_D24X8";1868 case SVGA3D_Z_DF16:1869 return "SVGA3D_Z_DF16";1870 case SVGA3D_Z_DF24:1871 return "SVGA3D_Z_DF24";1872 case SVGA3D_Z_D24S8_INT:1873 return "SVGA3D_Z_D24S8_INT";1874 case SVGA3D_LUMINANCE8:1875 return "SVGA3D_LUMINANCE8";1876 case SVGA3D_LUMINANCE4_ALPHA4:1877 return "SVGA3D_LUMINANCE4_ALPHA4";1878 case SVGA3D_LUMINANCE16:1879 return "SVGA3D_LUMINANCE16";1880 case SVGA3D_LUMINANCE8_ALPHA8:1881 return "SVGA3D_LUMINANCE8_ALPHA8";1882 case SVGA3D_DXT1:1883 return "SVGA3D_DXT1";1884 case SVGA3D_DXT2:1885 return "SVGA3D_DXT2";1886 case SVGA3D_DXT3:1887 return "SVGA3D_DXT3";1888 case SVGA3D_DXT4:1889 return "SVGA3D_DXT4";1890 case SVGA3D_DXT5:1891 return "SVGA3D_DXT5";1892 case SVGA3D_BUMPU8V8:1893 return "SVGA3D_BUMPU8V8";1894 case SVGA3D_BUMPL6V5U5:1895 return "SVGA3D_BUMPL6V5U5";1896 case SVGA3D_BUMPX8L8V8U8:1897 return "SVGA3D_BUMPX8L8V8U8";1898 case SVGA3D_BUMPL8V8U8:1899 return "SVGA3D_BUMPL8V8U8";1900 case SVGA3D_V8U8:1901 return "SVGA3D_V8U8";1902 case SVGA3D_Q8W8V8U8:1903 return "SVGA3D_Q8W8V8U8";1904 case SVGA3D_CxV8U8:1905 return "SVGA3D_CxV8U8";1906 case SVGA3D_X8L8V8U8:1907 return "SVGA3D_X8L8V8U8";1908 case SVGA3D_A2W10V10U10:1909 return "SVGA3D_A2W10V10U10";1910 case SVGA3D_ARGB_S10E5:1911 return "SVGA3D_ARGB_S10E5";1912 case SVGA3D_ARGB_S23E8:1913 return "SVGA3D_ARGB_S23E8";1914 case SVGA3D_A2R10G10B10:1915 return "SVGA3D_A2R10G10B10";1916 case SVGA3D_ALPHA8:1917 return "SVGA3D_ALPHA8";1918 case SVGA3D_R_S10E5:1919 return "SVGA3D_R_S10E5";1920 case SVGA3D_R_S23E8:1921 return "SVGA3D_R_S23E8";1922 case SVGA3D_RG_S10E5:1923 return "SVGA3D_RG_S10E5";1924 case SVGA3D_RG_S23E8:1925 return "SVGA3D_RG_S23E8";1926 case SVGA3D_BUFFER:1927 return "SVGA3D_BUFFER";1928 case SVGA3D_V16U16:1929 return "SVGA3D_V16U16";1930 case SVGA3D_G16R16:1931 return "SVGA3D_G16R16";1932 case SVGA3D_A16B16G16R16:1933 return "SVGA3D_A16B16G16R16";1934 case SVGA3D_UYVY:1935 return "SVGA3D_UYVY";1936 case SVGA3D_YUY2:1937 return "SVGA3D_YUY2";1938 case SVGA3D_NV12:1939 return "SVGA3D_NV12";1940 case SVGA3D_AYUV:1941 return "SVGA3D_AYUV";1942 case SVGA3D_BC4_UNORM:1943 return "SVGA3D_BC4_UNORM";1944 case SVGA3D_BC5_UNORM:1945 return "SVGA3D_BC5_UNORM";1946 }1947 return "UNKNOWN!!";1948 }1949 1950 1971 const char *vmsvga3dPrimitiveType2String(SVGA3dPrimitiveType PrimitiveType) 1951 1972 { -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.h
r57081 r57082 1265 1265 pContext->state.aLightData[i].fEnabled, 1266 1266 pContext->state.aLightData[i].data.inWorldSpace, 1267 pContext->state.aLightData[i].data.type < RT_ELEMENTS(g_apszLightTypes)1267 (uint32_t)pContext->state.aLightData[i].data.type < RT_ELEMENTS(g_apszLightTypes) 1268 1268 ? g_apszLightTypes[pContext->state.aLightData[i].data.type] : "UNKNOWN", 1269 1269 pContext->state.aLightData[i].data.type); … … 1586 1586 pHlp->pfnPrintf(pHlp, "idAssociatedContext: %#x\n", pSurface->idAssociatedContext); 1587 1587 #endif 1588 pHlp->pfnPrintf(pHlp, "Format: %s (%d)\n", vmsvgaSurfaceType2String(pSurface->format), pSurface->format); 1588 pHlp->pfnPrintf(pHlp, "Format: %s\n", 1589 vmsvgaFormatEnumValueEx(szTmp, sizeof(szTmp), NULL, (int)pSurface->format, false, &g_SVGA3dSurfaceFormat2String)); 1589 1590 pHlp->pfnPrintf(pHlp, "Flags: %#x", pSurface->flags); 1590 1591 vmsvga3dInfoU32Flags(pHlp, pSurface->flags, "SVGA3D_SURFACE_", g_aSvga3DSurfaceFlags, RT_ELEMENTS(g_aSvga3DSurfaceFlags)); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r57081 r57082 1392 1392 1393 1393 Log(("vmsvga3dSurfaceDefine: sid=%x surfaceFlags=%x format=%s (%x) multiSampleCount=%d autogenFilter=%d, cMipLevels=%d size=(%d,%d,%d)\n", 1394 sid, surfaceFlags, vmsvga SurfaceType2String(format), format, multisampleCount, autogenFilter, cMipLevels, pMipLevelSize->width, pMipLevelSize->height, pMipLevelSize->depth));1394 sid, surfaceFlags, vmsvgaLookupEnum((int)format, &g_SVGA3dSurfaceFormat2String), format, multisampleCount, autogenFilter, cMipLevels, pMipLevelSize->width, pMipLevelSize->height, pMipLevelSize->depth)); 1395 1395 1396 1396 AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h
r57081 r57082 142 142 /** Pointer to a read-only enum value translation entry. */ 143 143 typedef VMSVGAINFOENUM const *PCVMSVGAINFOENUM; 144 /** 145 * Structure for use with vmsvgaFormatEnumValueEx and vmsvgaFormatEnumValue. 146 */ 147 typedef struct VMSVGAINFOENUMMAP 148 { 149 /** Pointer to the value mapping array. */ 150 PCVMSVGAINFOENUM paValues; 151 /** The number of value mappings. */ 152 size_t cValues; 153 /** The prefix. */ 154 const char *pszPrefix; 155 #ifdef RT_STRICT 156 /** Indicates whether we've checked that it's sorted or not. */ 157 bool *pfAsserted; 158 #endif 159 } VMSVGAINFOENUMMAP; 160 typedef VMSVGAINFOENUMMAP const *PCVMSVGAINFOENUMMAP; 161 /** @def VMSVGAINFOENUMMAP_MAKE 162 * Macro for defining a VMSVGAINFOENUMMAP, silently dealing with pfAsserted. 163 * 164 * @param a_Scope The scope. RT_NOTHING or static. 165 * @param a_VarName The variable name for this map. 166 * @param a_aValues The variable name of the value mapping array. 167 * @param a_pszPrefix The value name prefix. 168 */ 169 #ifdef VBOX_STRICT 170 # define VMSVGAINFOENUMMAP_MAKE(a_Scope, a_VarName, a_aValues, a_pszPrefix) \ 171 static bool RT_CONCAT(a_VarName,_AssertedSorted) = false; \ 172 a_Scope VMSVGAINFOENUMMAP const a_VarName = { \ 173 a_aValues, RT_ELEMENTS(a_aValues), a_pszPrefix, &RT_CONCAT(a_VarName,_AssertedSorted) \ 174 } 175 #else 176 # define VMSVGAINFOENUMMAP_MAKE(a_Scope, a_VarName, a_aValues, a_pszPrefix) \ 177 a_Scope VMSVGAINFOENUMMAP const a_VarName = { a_aValues, RT_ELEMENTS(a_aValues), a_pszPrefix } 178 #endif 179 extern VMSVGAINFOENUMMAP const g_SVGA3dSurfaceFormat2String; 180 const char *vmsvgaLookupEnum(int32_t iValue, PCVMSVGAINFOENUMMAP pEnumMap); 144 181 char *vmsvgaFormatEnumValueEx(char *pszBuffer, size_t cbBuffer, const char *pszName, int32_t iValue, 145 const char *pszPrefix, PCVMSVGAINFOENUM paValues, size_t cValues);182 bool fPrefix, PCVMSVGAINFOENUMMAP pEnumMap); 146 183 char *vmsvgaFormatEnumValue(char *pszBuffer, size_t cbBuffer, const char *pszName, uint32_t uValue, 147 184 const char *pszPrefix, const char * const *papszValues, size_t cValues);
Note:
See TracChangeset
for help on using the changeset viewer.