Changeset 44746 in vbox
- Timestamp:
- Feb 19, 2013 11:05:23 AM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_server.h
r44740 r44746 247 247 void CrHlpFreeTexImage(CRContext *pCurCtx, GLuint idPBO, void *pvData); 248 248 void* CrHlpGetTexImage(CRContext *pCurCtx, PVBOXVR_TEXTURE pTexture, GLuint idPBO); 249 void CrHlpPutTexImage(CRContext *pCurCtx, PVBOXVR_TEXTURE pTexture, void *pvData); 249 250 250 251 /* */ -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r44744 r44746 154 154 * and generally this should be zeroed up */ 155 155 cr_server.currentCtxInfo = NULL; 156 cr_server.currentWindow = NULL;156 cr_server.currentWindow = 0; 157 157 cr_server.currentNativeWindow = 0; 158 158 cr_server.currentMural = NULL; … … 992 992 CRASSERT(cMurals + Data.cAdditionalMurals + crHashtableNumElements(pGlobal->additionalMuralContextTable) == crHashtableNumElements(cr_server.muralTable) - 1); 993 993 } 994 995 crFreeHashtable(Data.usedMuralTable, NULL); 994 996 } 995 997 … … 1038 1040 GLuint idPBO = cr_server.bUsePBOForReadback ? pMural->idPBO : 0; 1039 1041 1042 CRASSERT(!pContext->buffer.width); 1043 CRASSERT(!pContext->buffer.height); 1044 1040 1045 if (idPBO) 1041 1046 { … … 1137 1142 CRASSERT(pContext && pSSM); 1138 1143 CRASSERT(pMural); 1144 CRASSERT(pMural->CreateInfo.externalID); 1139 1145 1140 1146 /* We could have skipped saving the key and use similar callback to load context states back, … … 1155 1161 1156 1162 #ifdef CR_STATE_NO_TEXTURE_IMAGE_STORE 1157 if (pContextInfo->currentMural || crHashtableSearch(cr_server.muralTable, key)) 1163 if (pContextInfo->currentMural 1164 || crHashtableSearch(cr_server.muralTable, pMural->CreateInfo.externalID) /* <- this is not a dummy mural */ 1165 ) 1158 1166 { 1159 1167 CRASSERT(pMural->CreateInfo.externalID); 1168 CRASSERT(!crHashtableSearch(cr_server.dummyMuralTable, pMural->CreateInfo.externalID)); 1160 1169 pData->rc = SSMR3PutMem(pSSM, &pMural->CreateInfo.externalID, sizeof(pMural->CreateInfo.externalID)); 1161 1170 } 1162 1171 else 1163 1172 { 1173 /* this is a dummy mural */ 1164 1174 CRASSERT(!pMural->width); 1165 1175 CRASSERT(!pMural->height); 1166 CRASSERT(crHashtableSearch(cr_server.dummyMuralTable, key));1176 CRASSERT(crHashtableSearch(cr_server.dummyMuralTable, pMural->CreateInfo.externalID)); 1167 1177 pData->rc = SSMR3PutMem(pSSM, &i32Dummy, sizeof(pMural->CreateInfo.externalID)); 1168 1178 } … … 1578 1588 storedWidth = pMural->width; 1579 1589 storedHeight = pMural->height; 1580 CRASSERT(pContext->buffer.storedWidth == storedWidth);1581 CRASSERT(pContext->buffer.storedHeight == storedHeight);1582 1590 } 1583 1591 else … … 1625 1633 { 1626 1634 /* can apply the data right away */ 1627 crStateApplyFBImage(pContext); 1635 if (!pMural->fUseFBO) 1636 { 1637 CRASSERT(cr_server.bForceOffscreenRendering == CR_SERVER_REDIR_NONE); 1638 crStateApplyFBImage(pContext); 1639 } 1640 else 1641 { 1642 VBOXVR_TEXTURE Tex; 1643 Tex.width = pMural->width; 1644 Tex.height = pMural->height; 1645 Tex.target = GL_TEXTURE_2D; 1646 1647 CRASSERT(cr_server.bForceOffscreenRendering > CR_SERVER_REDIR_NONE); 1648 1649 if (pBuf->pFrontImg) 1650 { 1651 Tex.hwid = pMural->aidColorTexs[CR_SERVER_FBO_FB_IDX(pMural)]; 1652 CRASSERT(Tex.hwid); 1653 CrHlpPutTexImage(pContext, &Tex, pBuf->pFrontImg); 1654 } 1655 1656 if (pBuf->pBackImg) 1657 { 1658 Tex.hwid = pMural->aidColorTexs[CR_SERVER_FBO_BB_IDX(pMural)]; 1659 CRASSERT(Tex.hwid); 1660 CrHlpPutTexImage(pContext, &Tex, pBuf->pBackImg); 1661 } 1662 1663 crStateFreeFBImage(pContext); 1664 } 1628 1665 CRASSERT(!pBuf->pFrontImg); 1629 1666 CRASSERT(!pBuf->pBackImg); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r44740 r44746 286 286 } 287 287 288 void * CrHlpGetTexImage(CRContext *pCurCtx, PVBOXVR_TEXTURE pTexture, GLuint idPBO)289 { 290 void *pvData = NULL;288 void CrHlpPutTexImage(CRContext *pCurCtx, PVBOXVR_TEXTURE pTexture, void *pvData) 289 { 290 CRASSERT(pTexture->hwid); 291 291 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, pTexture->hwid); 292 292 293 if (idPBO) 294 { 295 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, idPBO); 296 } 297 else 298 { 299 if (!pCurCtx || crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_PACK_BUFFER_ARB)) 300 { 301 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); 302 } 303 304 pvData = crAlloc(4*pTexture->width*pTexture->height); 305 if (!pvData) 306 { 307 crWarning("Out of memory in CrHlpGetTexImage"); 308 return NULL; 309 } 293 if (!pCurCtx || crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_UNPACK_BUFFER_ARB)) 294 { 295 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); 310 296 } 311 297 312 298 /*read the texture, note pixels are NULL for PBO case as it's offset in the buffer*/ 313 cr_server.head_spu->dispatch_table. GetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, pvData);299 cr_server.head_spu->dispatch_table.TexSubImage2D(GL_TEXTURE_2D, 0 /* level*/, 0 /*xoffset*/, 0 /*yoffset*/, pTexture->width, pTexture->height, GL_BGRA, GL_UNSIGNED_BYTE, pvData); 314 300 315 301 /*restore gl state*/ … … 328 314 } 329 315 316 if (pCurCtx && crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_UNPACK_BUFFER_ARB)) 317 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pCurCtx->bufferobject.unpackBuffer->hwid); 318 } 319 320 void* CrHlpGetTexImage(CRContext *pCurCtx, PVBOXVR_TEXTURE pTexture, GLuint idPBO) 321 { 322 void *pvData = NULL; 323 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, pTexture->hwid); 324 325 if (idPBO) 326 { 327 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, idPBO); 328 } 329 else 330 { 331 if (!pCurCtx || crStateIsBufferBoundForCtx(pCurCtx, GL_PIXEL_PACK_BUFFER_ARB)) 332 { 333 cr_server.head_spu->dispatch_table.BindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); 334 } 335 336 pvData = crAlloc(4*pTexture->width*pTexture->height); 337 if (!pvData) 338 { 339 crWarning("Out of memory in CrHlpGetTexImage"); 340 return NULL; 341 } 342 } 343 344 /*read the texture, note pixels are NULL for PBO case as it's offset in the buffer*/ 345 cr_server.head_spu->dispatch_table.GetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, pvData); 346 347 /*restore gl state*/ 348 if (pCurCtx) 349 { 350 CRTextureObj *pTObj; 351 CRTextureLevel *pTImg; 352 crStateGetTextureObjectAndImage(pCurCtx, pTexture->target, 0, &pTObj, &pTImg); 353 354 GLuint uid = pTObj->hwid; 355 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, uid); 356 } 357 else 358 { 359 cr_server.head_spu->dispatch_table.BindTexture(pTexture->target, 0); 360 } 361 330 362 if (idPBO) 331 363 {
Note:
See TracChangeset
for help on using the changeset viewer.