Changeset 46343 in vbox for trunk/src/VBox/GuestHost/OpenGL
- Timestamp:
- May 31, 2013 1:27:10 PM (12 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk
r46147 r46343 107 107 util/warp.c \ 108 108 util/vreg.cpp \ 109 util/dump.cpp \ 109 110 util/blitter.cpp \ 110 111 util/vboxhgcm.c \ … … 135 136 VBoxOGLcrutil_pixel.c_CFLAGS.win.x86 += -Od 136 137 VBoxOGLhostcrutil_pixel.c_CFLAGS.win.x86 += -Od 138 ifdef VBOX_WITH_CRDUMPER 139 VBoxOGLcrutil_DEFS += VBOX_WITH_CRDUMPER 140 endif 137 141 138 142 # … … 175 179 $(PATH_SDK_$(VBOX_WINDDK)_LIB)/dxguid.lib 176 180 VBoxOGLhostcrutil_LIBS = $(LIB_RUNTIME) 181 ifdef VBOX_WITH_CRDUMPER 182 VBoxOGLhostcrutil_DEFS += VBOX_WITH_CRDUMPER 183 endif 177 184 ifdef VBOX_WITH_CRHGSMI 178 185 VBoxOGLhostcrutil_DEFS += VBOX_WITH_CRHGSMI -
trunk/src/VBox/GuestHost/OpenGL/include/cr_blitter.h
r45526 r46343 82 82 } CR_BLITTER_WINDOW, *PCR_BLITTER_WINDOW; 83 83 84 typedef struct CR_BLITTER_IMG 85 { 86 void *pvData; 87 GLuint cbData; 88 GLenum enmFormat; 89 GLuint width, height; 90 GLuint bpp; 91 GLuint pitch; 92 } CR_BLITTER_IMG, *PCR_BLITTER_IMG; 93 84 94 typedef struct CR_BLITTER 85 95 { … … 143 153 VBOXBLITTERDECL(void) CrBltLeave(PCR_BLITTER pBlitter); 144 154 VBOXBLITTERDECL(int) CrBltEnter(PCR_BLITTER pBlitter, const CR_BLITTER_CONTEXT *pRestoreCtxInfo, const CR_BLITTER_WINDOW *pRestoreMural); 145 VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags);155 VBOXBLITTERDECL(void) CrBltBlitTexMural(PCR_BLITTER pBlitter, bool fBb, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags); 146 156 VBOXBLITTERDECL(void) CrBltBlitTexTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *pSrcRect, const VBOXVR_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags); 157 VBOXBLITTERDECL(int) CrBltImgGetTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, GLenum enmFormat, CR_BLITTER_IMG *pDst); 158 159 VBOXBLITTERDECL(int) CrBltImgGetMural(PCR_BLITTER pBlitter, bool fBb, CR_BLITTER_IMG *pDst); 160 VBOXBLITTERDECL(void) CrBltImgFree(PCR_BLITTER pBlitter, CR_BLITTER_IMG *pDst); 147 161 VBOXBLITTERDECL(void) CrBltPresent(PCR_BLITTER pBlitter); 148 162 /* */ -
trunk/src/VBox/GuestHost/OpenGL/include/cr_pixeldata.h
r33280 r46343 44 44 45 45 DECLEXPORT(void) crDumpNamedTGA(const char *fname, GLint w, GLint h, GLvoid *data); 46 DECLEXPORT(void) crDumpNamedTGAV(const char* fname, GLint w, GLint h, GLvoid *data, va_list va); 47 DECLEXPORT(void) crDumpNamedTGAF(const char* fname, GLint w, GLint h, GLvoid *data, ...); 46 48 DECLEXPORT(void) crDumpTGA(GLint w, GLint h, GLvoid *data); 47 49 #ifdef __cplusplus -
trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h
r46173 r46343 16 16 #include "cr_blitter.h" 17 17 #include "spu_dispatch_table.h" 18 #include "cr_dump.h" 18 19 19 20 #include "state/cr_currentpointers.h" … … 530 531 PFNCRSERVERNOTIFYEVENT pfnNotifyEventCB; 531 532 533 SPUDispatchTable TmpCtxDispatch; 534 535 #ifdef VBOX_WITH_CRSERVER_DUMPER 536 CR_RECORDER Recorder; 537 CR_BLITTER RecorderBlitter; 538 CR_DBGPRINT_DUMPER DbgPrintDumper; 539 CR_HTML_DUMPER HtmlDumper; 540 CR_DUMPER *pDumper; 541 #endif 542 532 543 /* @todo: should we use just one blitter? 533 544 * we use two currently because the drawable attribs can differ*/ -
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r46085 r46343 88 88 if (pBlitter->Flags.CtxCreated) 89 89 pBlitter->pDispatch->DestroyContext(pBlitter->CtxInfo.Base.id); 90 memset(pBlitter, 0, sizeof (pBlitter)); 90 91 } 91 92 … … 515 516 void CrBltLeave(PCR_BLITTER pBlitter) 516 517 { 517 Assert(CrBltIsEntered(pBlitter)); 518 if (!CrBltIsEntered(pBlitter)) 519 { 520 crWarning("CrBltLeave: blitter not entered"); 521 return; 522 } 518 523 519 524 if (pBlitter->Flags.SupportsFBO) … … 610 615 } 611 616 612 void CrBltBlitTexMural(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags) 613 { 617 void CrBltBlitTexMural(PCR_BLITTER pBlitter, bool fBb, const VBOXVR_TEXTURE *pSrc, const RTRECT *paSrcRects, const RTRECT *paDstRects, uint32_t cRects, uint32_t fFlags) 618 { 619 if (!CrBltIsEntered(pBlitter)) 620 { 621 crWarning("CrBltBlitTexMural: blitter not entered"); 622 return; 623 } 624 614 625 RTRECTSIZE DstSize = {pBlitter->CurrentMural.width, pBlitter->CurrentMural.height}; 615 626 616 627 pBlitter->pDispatch->BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 0); 617 628 618 crBltBlitTexBuf(pBlitter, pSrc, paSrcRects, GL_BACK, &DstSize, paDstRects, cRects, fFlags);629 crBltBlitTexBuf(pBlitter, pSrc, paSrcRects, fBb ? GL_BACK : GL_FRONT, &DstSize, paDstRects, cRects, fFlags); 619 630 } 620 631 621 632 void CrBltBlitTexTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, const RTRECT *pSrcRect, const VBOXVR_TEXTURE *pDst, const RTRECT *pDstRect, uint32_t cRects, uint32_t fFlags) 622 633 { 634 if (!CrBltIsEntered(pBlitter)) 635 { 636 crWarning("CrBltBlitTexTex: blitter not entered"); 637 return; 638 } 639 623 640 RTRECTSIZE DstSize = {(uint32_t)pDst->width, (uint32_t)pDst->height}; 624 641 … … 639 656 void CrBltPresent(PCR_BLITTER pBlitter) 640 657 { 658 if (!CrBltIsEntered(pBlitter)) 659 { 660 crWarning("CrBltPresent: blitter not entered"); 661 return; 662 } 663 641 664 if (pBlitter->CtxInfo.Base.visualBits & CR_DOUBLE_BIT) 642 665 pBlitter->pDispatch->SwapBuffers(pBlitter->CurrentMural.Base.id, 0); … … 644 667 pBlitter->pDispatch->Flush(); 645 668 } 669 670 static int crBltImgCreateForTex(const VBOXVR_TEXTURE *pSrc, CR_BLITTER_IMG *pDst, GLenum enmFormat) 671 { 672 memset(pDst, 0, sizeof (*pDst)); 673 if (enmFormat != GL_RGBA 674 && enmFormat != GL_BGRA) 675 { 676 crWarning("unsupported format 0x%x", enmFormat); 677 return VERR_NOT_IMPLEMENTED; 678 } 679 680 uint32_t bpp = 32; 681 682 uint32_t pitch = ((bpp * pSrc->width) + 7) >> 3; 683 uint32_t cbData = pitch * pSrc->height; 684 pDst->pvData = RTMemAllocZ(cbData); 685 if (!pDst->pvData) 686 { 687 crWarning("RTMemAlloc failed"); 688 return VERR_NO_MEMORY; 689 } 690 691 #ifdef DEBUG_misha 692 { 693 char *pTmp = (char*)pDst->pvData; 694 for (uint32_t i = 0; i < cbData; ++i) 695 { 696 pTmp[i] = (char)((1 << i) % 255); 697 } 698 } 699 #endif 700 701 pDst->cbData = cbData; 702 pDst->enmFormat = enmFormat; 703 pDst->width = pSrc->width; 704 pDst->height = pSrc->height; 705 pDst->bpp = bpp; 706 pDst->pitch = pitch; 707 return VINF_SUCCESS; 708 } 709 710 VBOXBLITTERDECL(int) CrBltImgGetTex(PCR_BLITTER pBlitter, const VBOXVR_TEXTURE *pSrc, GLenum enmFormat, CR_BLITTER_IMG *pDst) 711 { 712 if (!CrBltIsEntered(pBlitter)) 713 { 714 crWarning("CrBltImgGetTex: blitter not entered"); 715 return VERR_INVALID_STATE; 716 } 717 718 int rc = crBltImgCreateForTex(pSrc, pDst, enmFormat); 719 if (!RT_SUCCESS(rc)) 720 { 721 crWarning("crBltImgCreateForTex failed, rc %d", rc); 722 return rc; 723 } 724 pBlitter->pDispatch->BindTexture(pSrc->target, pSrc->hwid); 725 726 #ifdef DEBUG_misha 727 { 728 GLint width = 0, height = 0, depth = 0; 729 pBlitter->pDispatch->GetTexLevelParameteriv(pSrc->target, 0, GL_TEXTURE_WIDTH, &width); 730 pBlitter->pDispatch->GetTexLevelParameteriv(pSrc->target, 0, GL_TEXTURE_HEIGHT, &height); 731 pBlitter->pDispatch->GetTexLevelParameteriv(pSrc->target, 0, GL_TEXTURE_DEPTH, &depth); 732 733 Assert(width == pSrc->width); 734 Assert(height == pSrc->height); 735 // Assert(depth == pSrc->depth); 736 } 737 #endif 738 739 pBlitter->pDispatch->GetTexImage(pSrc->target, 0, enmFormat, GL_UNSIGNED_BYTE, pDst->pvData); 740 741 pBlitter->pDispatch->BindTexture(pSrc->target, 0); 742 return VINF_SUCCESS; 743 } 744 745 VBOXBLITTERDECL(int) CrBltImgGetMural(PCR_BLITTER pBlitter, bool fBb, CR_BLITTER_IMG *pDst) 746 { 747 if (!CrBltIsEntered(pBlitter)) 748 { 749 crWarning("CrBltImgGetMural: blitter not entered"); 750 return VERR_INVALID_STATE; 751 } 752 753 crWarning("NOT IMPLEMENTED"); 754 return VERR_NOT_IMPLEMENTED; 755 } 756 757 VBOXBLITTERDECL(void) CrBltImgFree(PCR_BLITTER pBlitter, CR_BLITTER_IMG *pDst) 758 { 759 if (!CrBltIsEntered(pBlitter)) 760 { 761 crWarning("CrBltImgFree: blitter not entered"); 762 return; 763 } 764 765 if (pDst->pvData) 766 { 767 RTMemFree(pDst->pvData); 768 pDst->pvData = NULL; 769 } 770 } 771 -
trunk/src/VBox/GuestHost/OpenGL/util/pixel.c
r35263 r46343 11 11 #include <stdio.h> 12 12 #include <math.h> 13 14 #include <iprt/string.h> 13 15 14 16 #if defined(WINDOWS) … … 1842 1844 fclose(out); 1843 1845 } 1846 1847 void crDumpNamedTGAV(const char* fname, GLint w, GLint h, GLvoid *data, va_list va) 1848 { 1849 char szName[4096]; 1850 RTStrPrintfV(szName, sizeof(szName), fname, va); 1851 crDumpNamedTGA(szName, w, h, data); 1852 } 1853 1854 void crDumpNamedTGAF(const char* fname, GLint w, GLint h, GLvoid *data, ...) 1855 { 1856 va_list va; 1857 int rc; 1858 va_start(va, fname); 1859 crDumpNamedTGAV(fname, w, h, data, va); 1860 va_end(va); 1861 }
Note:
See TracChangeset
for help on using the changeset viewer.