Changeset 44972 in vbox for trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
- Timestamp:
- Mar 11, 2013 11:01:17 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/util/blitter.cpp
r44766 r44972 104 104 DECLINLINE(GLfloat*) crBltVtRectTFNormalized(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff) 105 105 { 106 /* going ccw: 107 * 1. (left;top) 4. (right;top) 108 * | ^ 109 * > | 110 * 2. (left;bottom) -> 3. (right;bottom) */ 106 111 /* xLeft yTop */ 107 112 pBuff[0] = ((float)pRect->xLeft)/((float)normalX); … … 159 164 160 165 /* Indexed GL_TRIANGLES */ 161 DECLINLINE(GLfloat*) crBltVtRectITNormalized(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff , GLubyte **ppIndex, GLubyte *piBase)166 DECLINLINE(GLfloat*) crBltVtRectITNormalized(const RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLfloat* pBuff) 162 167 { 163 168 GLfloat* ret = crBltVtRectTFNormalized(pRect, normalX, normalY, pBuff); 169 return ret; 170 } 171 172 DECLINLINE(GLint*) crBltVtRectIT(RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff, GLubyte **ppIndex, GLubyte *piBase) 173 { 174 GLint* ret = crBltVtRectTF(pRect, normalX, normalY, pBuff); 164 175 165 176 if (ppIndex) … … 169 180 } 170 181 171 DECLINLINE(GLint*) crBltVtRectIT(RTRECT *pRect, uint32_t normalX, uint32_t normalY, GLint* pBuff, GLubyte **ppIndex, GLubyte *piBase) 172 { 173 GLint* ret = crBltVtRectTF(pRect, normalX, normalY, pBuff); 182 DECLINLINE(GLuint) crBltVtGetNumVerticiesTF(GLuint cRects) 183 { 184 return cRects * 4; 185 } 186 187 #define crBltVtGetNumVerticiesIT crBltVtGetNumVerticiesTF 188 189 DECLINLINE(GLuint) crBltVtGetNumIndiciesIT(GLuint cRects) 190 { 191 return 6 * cRects; 192 } 193 194 195 static GLfloat* crBltVtRectsITNormalized(const RTRECT *paRects, uint32_t cRects, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase) 196 { 197 uint32_t i; 198 for (i = 0; i < cRects; ++i) 199 { 200 pBuff = crBltVtRectITNormalized(&paRects[i], normalX, normalY, pBuff); 201 } 202 174 203 175 204 if (ppIndex) 176 *ppIndex = crBltVtFillRectIndicies(*ppIndex, piBase); 177 178 return ret; 179 } 180 181 DECLINLINE(GLuint) crBltVtGetNumVerticiesTF(GLuint cRects) 182 { 183 return cRects * 4; 184 } 185 186 #define crBltVtGetNumVerticiesIT crBltVtGetNumVerticiesTF 187 188 DECLINLINE(GLuint) crBltVtGetNumIndiciesIT(GLuint cRects) 189 { 190 return 6 * cRects; 191 } 192 193 194 static GLfloat* crBltVtRectsITNormalized(const RTRECT *paRects, uint32_t cRects, uint32_t normalX, uint32_t normalY, GLfloat* pBuff, GLubyte **ppIndex, GLubyte *piBase) 195 { 196 for (uint32_t i = 0; i < cRects; ++i) 197 { 198 pBuff = crBltVtRectITNormalized(&paRects[i], normalX, normalY, pBuff, ppIndex, piBase); 199 } 205 { 206 GLubyte *pIndex = (GLubyte*)pBuff; 207 *ppIndex = pIndex; 208 for (i = 0; i < cRects; ++i) 209 { 210 pIndex = crBltVtFillRectIndicies(pIndex, piBase); 211 } 212 pBuff = (GLfloat*)pIndex; 213 } 214 200 215 return pBuff; 201 216 } … … 310 325 { 311 326 pVerticies = (GLfloat*)crBltBufGet(&pBlitter->Verticies, cElements * 2 * 2 * sizeof (*pVerticies)); 312 pTexCoords = crBltVtRectTFNormalized(paDstRect, normalX, normalY, pVerticies);327 pTexCoords = crBltVtRectTFNormalized(paDstRect, 1, 1, pVerticies); 313 328 crBltVtRectTFNormalized(paSrcRect, normalX, normalY, pTexCoords); 314 329 } … … 318 333 319 334 pBlitter->pDispatch->EnableClientState(GL_TEXTURE_COORD_ARRAY); 320 pBlitter->pDispatch-> VertexPointer(2, GL_FLOAT, 0, pTexCoords);335 pBlitter->pDispatch->TexCoordPointer(2, GL_FLOAT, 0, pTexCoords); 321 336 322 337 pBlitter->pDispatch->Enable(pSrc->target); … … 347 362 { 348 363 pVerticies = (GLfloat*)crBltBufGet(&pBlitter->Verticies, cElements * 2 * 2 * sizeof (*pVerticies)); 349 pTexCoords = crBltVtRectsITNormalized(paDstRect, cRects, normalX, normalY, pVerticies, &pIndicies, &iIdxBase);364 pTexCoords = crBltVtRectsITNormalized(paDstRect, cRects, 1, 1, pVerticies, &pIndicies, &iIdxBase); 350 365 crBltVtRectsITNormalized(paSrcRect, cRects, normalX, normalY, pTexCoords, NULL, NULL); 351 366 } … … 355 370 356 371 pBlitter->pDispatch->EnableClientState(GL_TEXTURE_COORD_ARRAY); 357 pBlitter->pDispatch-> VertexPointer(2, GL_FLOAT, 0, pTexCoords);372 pBlitter->pDispatch->TexCoordPointer(2, GL_FLOAT, 0, pTexCoords); 358 373 359 374 pBlitter->pDispatch->Enable(pSrc->target); … … 411 426 if (pBlitter->pRestoreCtxInfo != &pBlitter->CtxInfo) 412 427 { 413 // GLuint idDrawFBO, idReadFBO;414 // CR_BLITTER_WINDOW *pRestoreMural = pBlitter->pRestoreMural;415 // if (pRestoreMural->fUseFBO && crServerSupportRedirMuralFBO())416 // {417 // idDrawFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurDrawBuffer];418 // idReadFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurReadBuffer];419 // }420 // else421 // {422 // idDrawFBO = 0;423 // idReadFBO = 0;424 // }425 428 426 429 pBlitter->pDispatch->MakeCurrent(pBlitter->pRestoreMural->Base.id, 0, 427 430 pBlitter->pRestoreCtxInfo->Base.id >= 0 428 431 ? pBlitter->pRestoreCtxInfo->Base.id : pBlitter->pRestoreCtxInfo->Base.id); 429 // crStateSwitchPostprocess(pBlitter->pRestoreCtxInfo->pContext, NULL, idDrawFBO, idReadFBO);430 432 } 431 433 else … … 455 457 pBlitter->pRestoreCtxInfo = pRestoreCtxInfo; 456 458 pBlitter->pRestoreMural = pRestoreMural; 457 458 // GLuint idDrawFBO, idReadFBO;459 //460 // if (pRestoreMural->fUseFBO && crServerSupportRedirMuralFBO())461 // {462 // idDrawFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurDrawBuffer];463 // idReadFBO = pRestoreMural->aidFBOs[pRestoreMural->iCurReadBuffer];464 // }465 // else466 // {467 // idDrawFBO = 0;468 // idReadFBO = 0;469 // }470 // crStateSwitchPrepare(NULL, pRestoreCtxInfo->pContext, idDrawFBO, idReadFBO);471 459 472 460 pBlitter->pDispatch->Flush();
Note:
See TracChangeset
for help on using the changeset viewer.