Changeset 44290 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
- Timestamp:
- Jan 14, 2013 9:49:11 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83199
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r43932 r44290 810 810 } 811 811 812 void CrHlpFreeTexImage(CRContext *pCurCtx, GLuint idPBO, void *pvData) 813 { 814 if (idPBO) 815 { 816 cr_server.head_spu->dispatch_table.UnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB); 817 if (pCurCtx) 818 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pCurCtx->bufferobject.packBuffer->hwid); 819 else 820 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, NULL); 821 } 822 else 823 { 824 crFree(pvData); 825 if (pCurCtx && crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_PACK_BUFFER_ARB)) 826 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pCurCtx->bufferobject.packBuffer->hwid); 827 } 828 } 829 830 void* CrHlpGetTexImage(CRContext *pCurCtx, PCR_BLITTER_TEXTURE pTexture, GLuint idPBO) 831 { 832 void *pvData = NULL; 833 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, pTexture->hwid); 834 835 if (idPBO) 836 { 837 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, idPBO); 838 } 839 else 840 { 841 if (!pCurCtx || crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_PACK_BUFFER_ARB)) 842 { 843 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); 844 } 845 846 pvData = crAlloc(4*pTexture->width*pTexture->height); 847 if (!pvData) 848 { 849 crWarning("Out of memory in CrHlpGetTexImage"); 850 return NULL; 851 } 852 } 853 854 /*read the texture, note pixels are NULL for PBO case as it's offset in the buffer*/ 855 cr_server.head_spu->dispatch_table.GetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, pvData); 856 857 /*restore gl state*/ 858 if (pCurCtx) 859 { 860 CRTextureObj *pTObj; 861 CRTextureLevel *pTImg; 862 crStateGetTextureObjectAndImage(pCurCtx, pTexture->target, 0, &pTObj, &pTImg); 863 864 GLuint uid = pTObj->hwid; 865 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, uid); 866 } 867 else 868 { 869 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, 0); 870 } 871 872 if (idPBO) 873 { 874 pvData = cr_server.head_spu->dispatch_table.MapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY); 875 if (!pvData) 876 { 877 crWarning("Failed to MapBuffer in CrHlpGetTexImage"); 878 return NULL; 879 } 880 } 881 882 CRASSERT(pvData); 883 return pvData; 884 } 885 812 886 void SERVER_DISPATCH_APIENTRY 813 887 crServerDispatchTexPresent(GLuint texture, GLuint cfg, GLint xPos, GLint yPos, GLint cRects, GLint *pRects)
Note:
See TracChangeset
for help on using the changeset viewer.