Changeset 46173 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- May 20, 2013 12:15:50 PM (12 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server.h
r45940 r46173 174 174 void crServerPresentFBO(CRMuralInfo *mural); 175 175 GLboolean crServerIsRedirectedToFBO(); 176 GL uint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer);176 GLint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer); 177 177 void crServerMuralFBOSwapBuffers(CRMuralInfo *mural); 178 178 … … 190 190 #define CR_SERVER_FBO_BB_IDX(_mural) ((_mural)->iBbBuffer) 191 191 #define CR_SERVER_FBO_FB_IDX(_mural) (((_mural)->iBbBuffer + 1) % ((_mural)->cBuffers)) 192 /* returns a valid index to be used for negative _idx, i.e. for GL_NONE cases */ 193 //#define CR_SERVER_FBO_ADJUST_IDX(_mural, _idx) ((_idx) >= 0 ? (_idx) : CR_SERVER_FBO_BB_IDX(_mural)) 194 /* just a helper that uses CR_SERVER_FBO_ADJUST_IDX for getting mural's FBO id for buffer index*/ 195 //#define CR_SERVER_FBO_FOR_IDX(_mural, _idx) ((_mural)->aidFBOs[CR_SERVER_FBO_ADJUST_IDX((_mural), (_idx))]) 196 //#define CR_SERVER_FBO_TEX_FOR_IDX(_mural, _idx) ((_mural)->aidColorTexs[CR_SERVER_FBO_ADJUST_IDX((_mural), (_idx))]) 197 #define CR_SERVER_FBO_FOR_IDX(_mural, _idx) ((_idx) >= 0 ? (_mural)->aidFBOs[(_idx)] : 0) 198 #define CR_SERVER_FBO_TEX_FOR_IDX(_mural, _idx) ((_idx) >= 0 ? (_mural)->aidColorTexs[(_idx)] : 0) 192 199 193 200 int32_t crVBoxServerInternalClientRead(CRClient *pClient, uint8_t *pBuffer, uint32_t *pcbBuffer); … … 355 362 if (pCurrentMural) 356 363 { 357 idDrawFBO = pCurrentMural->aidFBOs[pCurrentMural->iCurDrawBuffer];358 idReadFBO = pCurrentMural->aidFBOs[pCurrentMural->iCurReadBuffer];364 idDrawFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurDrawBuffer); 365 idReadFBO = CR_SERVER_FBO_FOR_IDX(pCurrentMural, pCurrentMural->iCurReadBuffer); 359 366 } 360 367 else -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_context.c
r45616 r46173 297 297 if (oldMural && (oldMural->fPresentMode & CR_SERVER_REDIR_F_FBO) && crServerSupportRedirMuralFBO()) 298 298 { 299 idDrawFBO = oldMural->aidFBOs[oldMural->iCurDrawBuffer];300 idReadFBO = oldMural->aidFBOs[oldMural->iCurReadBuffer];299 idDrawFBO = CR_SERVER_FBO_FOR_IDX(oldMural, oldMural->iCurDrawBuffer); 300 idReadFBO = CR_SERVER_FBO_FOR_IDX(oldMural, oldMural->iCurReadBuffer); 301 301 } 302 302 else … … 393 393 } 394 394 395 idDrawFBO = mural->aidFBOs[mural->iCurDrawBuffer];396 idReadFBO = mural->aidFBOs[mural->iCurReadBuffer];395 idDrawFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer); 396 idReadFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer); 397 397 } 398 398 else -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_framebuffer.c
r44529 r46173 82 82 if (0==framebuffer && crServerIsRedirectedToFBO()) 83 83 { 84 CRMuralInfo *mural = cr_server.curClient->currentMural; 84 85 if (target == GL_FRAMEBUFFER) 85 86 { 86 GLuint idDrawFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer];87 GLuint idReadFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer];87 GLuint idDrawFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer); 88 GLuint idReadFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer); 88 89 if (idDrawFBO == idReadFBO) 89 90 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_FRAMEBUFFER, idDrawFBO); … … 96 97 else if (target == GL_READ_FRAMEBUFFER) 97 98 { 98 GLuint idReadFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer];99 GLuint idReadFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer); 99 100 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, idReadFBO); 100 101 } 101 102 else if (target == GL_DRAW_FRAMEBUFFER) 102 103 { 103 GLuint idDrawFBO = cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer];104 GLuint idDrawFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer); 104 105 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, idDrawFBO); 105 106 } … … 113 114 if (GL_FRAMEBUFFER_EXT == target) 114 115 { 115 Assert(rfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]);116 Assert(dfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]);116 Assert(rfb == CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 117 Assert(dfb == CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer)); 117 118 } 118 119 else if (GL_READ_FRAMEBUFFER_EXT == target) 119 120 { 120 Assert(rfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]);121 Assert(rfb == CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 121 122 } 122 123 else if (GL_DRAW_FRAMEBUFFER_EXT == target) 123 124 { 124 Assert(dfb == cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]);125 Assert(dfb == CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer)); 125 126 } 126 127 else -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r45942 r46173 1090 1090 return VINF_SUCCESS; 1091 1091 1092 pData->idFBO = pMural && (pMural->fPresentMode & CR_SERVER_REDIR_F_FBO) ? pMural->aidColorTexs[fWrite ? pMural->iCurDrawBuffer : pMural->iCurReadBuffer] : 0; 1092 if (pMural) 1093 { 1094 if (fWrite) 1095 { 1096 if (!pContext->framebufferobject.drawFB) 1097 pData->idOverrrideFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurDrawBuffer); 1098 } 1099 else 1100 { 1101 if (!pContext->framebufferobject.readFB) 1102 pData->idOverrrideFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurReadBuffer); 1103 } 1104 } 1093 1105 pData->cElements = 0; 1094 1106 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r45577 r46173 813 813 CrBltMuralSetCurrent(pBlitter, &BltInfo); 814 814 815 idDrawFBO = mural->aidFBOs[mural->iCurDrawBuffer];816 idReadFBO = mural->aidFBOs[mural->iCurReadBuffer];815 idDrawFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer); 816 idReadFBO = CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer); 817 817 818 818 crStateSwitchPrepare(NULL, ctx, idDrawFBO, idReadFBO); … … 1140 1140 && cr_server.curClient->currentMural->aidFBOs[0]) 1141 1141 { 1142 GLuint iBufferNeeded; 1142 CRMuralInfo *mural = cr_server.curClient->currentMural; 1143 GLint iBufferNeeded = -1; 1143 1144 switch (mode) 1144 1145 { … … 1147 1148 case GL_BACK_RIGHT: 1148 1149 mode = GL_COLOR_ATTACHMENT0; 1149 iBufferNeeded = CR_SERVER_FBO_BB_IDX( cr_server.curClient->currentMural);1150 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1150 1151 break; 1151 1152 case GL_FRONT: … … 1153 1154 case GL_FRONT_RIGHT: 1154 1155 mode = GL_COLOR_ATTACHMENT0; 1155 iBufferNeeded = CR_SERVER_FBO_FB_IDX(cr_server.curClient->currentMural); 1156 iBufferNeeded = CR_SERVER_FBO_FB_IDX(mural); 1157 break; 1158 case GL_NONE: 1159 crDebug("DrawBuffer: GL_NONE"); 1160 break; 1161 case GL_AUX0: 1162 crDebug("DrawBuffer: GL_AUX0"); 1163 break; 1164 case GL_AUX1: 1165 crDebug("DrawBuffer: GL_AUX1"); 1166 break; 1167 case GL_AUX2: 1168 crDebug("DrawBuffer: GL_AUX2"); 1169 break; 1170 case GL_AUX3: 1171 crDebug("DrawBuffer: GL_AUX3"); 1172 break; 1173 case GL_LEFT: 1174 crWarning("DrawBuffer: GL_LEFT not supported properly"); 1175 mode = GL_COLOR_ATTACHMENT0; 1176 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1177 break; 1178 case GL_RIGHT: 1179 crWarning("DrawBuffer: GL_RIGHT not supported properly"); 1180 mode = GL_COLOR_ATTACHMENT0; 1181 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1182 break; 1183 case GL_FRONT_AND_BACK: 1184 crWarning("DrawBuffer: GL_FRONT_AND_BACK not supported properly"); 1185 mode = GL_COLOR_ATTACHMENT0; 1186 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1156 1187 break; 1157 1188 default: 1158 crWarning(" unexpected mode! 0x%x", mode);1159 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural);1189 crWarning("DrawBuffer: unexpected mode! 0x%x", mode); 1190 iBufferNeeded = mural->iCurDrawBuffer; 1160 1191 break; 1161 1192 } 1162 1193 1163 Assert(cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]); 1164 if (iBufferNeeded != cr_server.curClient->currentMural->iCurDrawBuffer) 1194 if (iBufferNeeded != mural->iCurDrawBuffer) 1165 1195 { 1166 cr_server.curClient->currentMural->iCurDrawBuffer = iBufferNeeded; 1167 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, 1168 cr_server.curClient->currentMural->aidFBOs[iBufferNeeded]); 1196 mural->iCurDrawBuffer = iBufferNeeded; 1197 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, iBufferNeeded)); 1169 1198 } 1170 1199 } … … 1182 1211 && !crStateGetCurrent()->framebufferobject.readFB) 1183 1212 { 1184 GLuint iBufferNeeded; 1213 CRMuralInfo *mural = cr_server.curClient->currentMural; 1214 GLint iBufferNeeded = -1; 1185 1215 switch (mode) 1186 1216 { … … 1189 1219 case GL_BACK_RIGHT: 1190 1220 mode = GL_COLOR_ATTACHMENT0; 1191 iBufferNeeded = CR_SERVER_FBO_BB_IDX( cr_server.curClient->currentMural);1221 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1192 1222 break; 1193 1223 case GL_FRONT: … … 1195 1225 case GL_FRONT_RIGHT: 1196 1226 mode = GL_COLOR_ATTACHMENT0; 1197 iBufferNeeded = CR_SERVER_FBO_FB_IDX(cr_server.curClient->currentMural); 1227 iBufferNeeded = CR_SERVER_FBO_FB_IDX(mural); 1228 break; 1229 case GL_NONE: 1230 crDebug("ReadBuffer: GL_NONE"); 1231 break; 1232 case GL_AUX0: 1233 crDebug("ReadBuffer: GL_AUX0"); 1234 break; 1235 case GL_AUX1: 1236 crDebug("ReadBuffer: GL_AUX1"); 1237 break; 1238 case GL_AUX2: 1239 crDebug("ReadBuffer: GL_AUX2"); 1240 break; 1241 case GL_AUX3: 1242 crDebug("ReadBuffer: GL_AUX3"); 1243 break; 1244 case GL_LEFT: 1245 crWarning("ReadBuffer: GL_LEFT not supported properly"); 1246 mode = GL_COLOR_ATTACHMENT0; 1247 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1248 break; 1249 case GL_RIGHT: 1250 crWarning("ReadBuffer: GL_RIGHT not supported properly"); 1251 mode = GL_COLOR_ATTACHMENT0; 1252 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1253 break; 1254 case GL_FRONT_AND_BACK: 1255 crWarning("ReadBuffer: GL_FRONT_AND_BACK not supported properly"); 1256 mode = GL_COLOR_ATTACHMENT0; 1257 iBufferNeeded = CR_SERVER_FBO_BB_IDX(mural); 1198 1258 break; 1199 1259 default: 1200 crWarning("unexpected mode! 0x%x", mode); 1201 iBufferNeeded = CR_SERVER_FBO_BB_IDX(cr_server.curClient->currentMural); 1202 break; 1203 } 1204 1205 Assert(cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]); 1206 if (iBufferNeeded != cr_server.curClient->currentMural->iCurReadBuffer) 1207 { 1208 cr_server.curClient->currentMural->iCurReadBuffer = iBufferNeeded; 1209 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, 1210 cr_server.curClient->currentMural->aidFBOs[iBufferNeeded]); 1260 crWarning("ReadBuffer: unexpected mode! 0x%x", mode); 1261 iBufferNeeded = mural->iCurDrawBuffer; 1262 break; 1263 } 1264 1265 Assert(CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 1266 if (iBufferNeeded != mural->iCurReadBuffer) 1267 { 1268 mural->iCurReadBuffer = iBufferNeeded; 1269 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, iBufferNeeded)); 1211 1270 } 1212 1271 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_muralfbo.c
r45942 r46173 404 404 if (!crStateGetCurrent()->framebufferobject.drawFB) 405 405 { 406 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);406 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer)); 407 407 } 408 408 if (!crStateGetCurrent()->framebufferobject.readFB) 409 409 { 410 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);410 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 411 411 } 412 412 … … 675 675 if (currentMural) 676 676 { 677 idDrawFBO = currentMural->aidFBOs[currentMural->iCurDrawBuffer];678 idReadFBO = currentMural->aidFBOs[currentMural->iCurReadBuffer];677 idDrawFBO = CR_SERVER_FBO_FOR_IDX(currentMural, currentMural->iCurDrawBuffer); 678 idReadFBO = CR_SERVER_FBO_FOR_IDX(currentMural, currentMural->iCurReadBuffer); 679 679 } 680 680 else … … 988 988 } 989 989 990 GL uint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer)990 GLint crServerMuralFBOIdxFromBufferName(CRMuralInfo *mural, GLenum buffer) 991 991 { 992 992 if (buffer == GL_FRONT … … 994 994 || buffer == GL_FRONT_RIGHT) 995 995 return CR_SERVER_FBO_FB_IDX(mural); 996 return CR_SERVER_FBO_BB_IDX(mural); 996 if (buffer == GL_BACK 997 || buffer == GL_BACK_LEFT 998 || buffer == GL_BACK_RIGHT) 999 return CR_SERVER_FBO_BB_IDX(mural); 1000 if (buffer == GL_NONE) 1001 return -1; 1002 1003 crWarning("crServerMuralFBOIdxFromBufferName: invalid buffer passed 0x%x", buffer); 1004 return -2; 997 1005 } 998 1006 … … 1003 1011 GLuint iOldCurReadBuffer = mural->iCurReadBuffer; 1004 1012 mural->iBbBuffer = ((mural->iBbBuffer + 1) % (mural->cBuffers)); 1005 mural->iCurDrawBuffer = ((mural->iCurDrawBuffer + 1) % (mural->cBuffers)); 1006 mural->iCurReadBuffer = ((mural->iCurReadBuffer + 1) % (mural->cBuffers)); 1007 Assert(iOldCurDrawBuffer != mural->iCurDrawBuffer || mural->cBuffers == 1); 1008 Assert(iOldCurReadBuffer != mural->iCurReadBuffer || mural->cBuffers == 1); 1013 if (mural->iCurDrawBuffer >= 0) 1014 mural->iCurDrawBuffer = ((mural->iCurDrawBuffer + 1) % (mural->cBuffers)); 1015 if (mural->iCurReadBuffer >= 0) 1016 mural->iCurReadBuffer = ((mural->iCurReadBuffer + 1) % (mural->cBuffers)); 1017 Assert(iOldCurDrawBuffer != mural->iCurDrawBuffer || mural->cBuffers == 1 || mural->iCurDrawBuffer < 0); 1018 Assert(iOldCurReadBuffer != mural->iCurReadBuffer || mural->cBuffers == 1 || mural->iCurReadBuffer < 0); 1009 1019 if (!ctx->framebufferobject.drawFB && iOldCurDrawBuffer != mural->iCurDrawBuffer) 1010 1020 { 1011 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, mural->aidFBOs[mural->iCurDrawBuffer]);1021 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurDrawBuffer)); 1012 1022 } 1013 1023 if (!ctx->framebufferobject.readFB && iOldCurReadBuffer != mural->iCurReadBuffer) 1014 1024 { 1015 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, mural->aidFBOs[mural->iCurReadBuffer]);1025 cr_server.head_spu->dispatch_table.BindFramebufferEXT(GL_READ_FRAMEBUFFER, CR_SERVER_FBO_FOR_IDX(mural, mural->iCurReadBuffer)); 1016 1026 } 1017 1027 Assert(mural->aidColorTexs[CR_SERVER_FBO_FB_IDX(mural)]); -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_presenter.cpp
r46061 r46173 128 128 if (pMural) 129 129 { 130 idDrawFBO = pMural->aidFBOs[pMural->iCurDrawBuffer];131 idReadFBO = pMural->aidFBOs[pMural->iCurReadBuffer];130 idDrawFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurDrawBuffer); 131 idReadFBO = CR_SERVER_FBO_FOR_IDX(pMural, pMural->iCurReadBuffer); 132 132 } 133 133 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_simpleget.py
r44444 r46173 91 91 { 92 92 if (crServerIsRedirectedToFBO() 93 && cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurReadBuffer]93 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurReadBuffer) 94 94 && !crStateGetCurrent()->framebufferobject.readFB) 95 95 { 96 96 *get_values = (%s) crStateGetCurrent()->buffer.readBuffer; 97 Assert(crStateGetCurrent()->buffer.readBuffer == GL_BACK || crStateGetCurrent()->buffer.readBuffer == GL_FRONT); 97 98 } 98 99 } … … 100 101 { 101 102 if (crServerIsRedirectedToFBO() 102 && cr_server.curClient->currentMural->aidFBOs[cr_server.curClient->currentMural->iCurDrawBuffer]103 && CR_SERVER_FBO_FOR_IDX(cr_server.curClient->currentMural, cr_server.curClient->currentMural->iCurDrawBuffer) 103 104 && !crStateGetCurrent()->framebufferobject.drawFB) 104 105 { 105 106 *get_values = (%s) crStateGetCurrent()->buffer.drawBuffer; 107 Assert(crStateGetCurrent()->buffer.drawBuffer == GL_BACK || crStateGetCurrent()->buffer.drawBuffer == GL_FRONT); 106 108 } 107 109 }
Note:
See TracChangeset
for help on using the changeset viewer.