Changeset 44816 in vbox
- Timestamp:
- Feb 25, 2013 12:50:56 PM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_version.h
r44802 r44816 22 22 #define SHCROGL_SSM_VERSION_WITH_FIXED_STENCIL 34 23 23 #define SHCROGL_SSM_VERSION_WITH_SAVED_DEPTH_STENCIL_BUFFER 35 24 #define SHCROGL_SSM_VERSION 35 24 /* some ogl drivers fail to Read/DrawPixels for DEPTH and STENCIL separately 25 * from DEPTH_STENCIL renderbuffer we used for offscreen rendering 26 * this is why we switched to glReadDrawPixels(GL_DEPTH_STENCIL) in one run */ 27 #define SHCROGL_SSM_VERSION_WITH_SINGLE_DEPTH_STENCIL 36 28 #define SHCROGL_SSM_VERSION 36 25 29 26 30 /* These define the Chromium release number. -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_diff.c
r44812 r44816 10 10 #include "cr_pixeldata.h" 11 11 #include <iprt/err.h> 12 #include <stdio.h> 12 13 13 14 void crStateDiffContext( CRContext *from, CRContext *to ) … … 164 165 CRFBDataElement *el = &data->aElements[i]; 165 166 166 switch (el->enmFormat) 167 { 168 case GL_DEPTH_COMPONENT: 169 if (!to->buffer.depthTest) 170 { 171 diff_api.Enable(GL_DEPTH_TEST); 172 } 173 if (to->pixel.depthScale != 1.0f) 174 { 175 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 176 } 177 if (to->pixel.depthBias != 0.0f) 178 { 179 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 180 } 181 break; 182 case GL_STENCIL_INDEX: 183 if (!to->stencil.stencilTest) 184 { 185 diff_api.Enable(GL_STENCIL_TEST); 186 } 187 if (to->pixel.mapStencil) 188 { 189 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 190 } 191 if (to->pixel.indexOffset) 192 { 193 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 194 } 195 if (to->pixel.indexShift) 196 { 197 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 198 } 199 break; 200 default: 201 break; 167 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 168 { 169 if (!to->buffer.depthTest) 170 { 171 diff_api.Enable(GL_DEPTH_TEST); 172 } 173 if (to->pixel.depthScale != 1.0f) 174 { 175 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 176 } 177 if (to->pixel.depthBias != 0.0f) 178 { 179 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 180 } 181 } 182 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 183 { 184 if (!to->stencil.stencilTest) 185 { 186 diff_api.Enable(GL_STENCIL_TEST); 187 } 188 if (to->pixel.mapStencil) 189 { 190 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 191 } 192 if (to->pixel.indexOffset) 193 { 194 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 195 } 196 if (to->pixel.indexShift) 197 { 198 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 199 } 202 200 } 203 201 … … 210 208 crDebug("Acquired %d;%d;%d;%d;%d;0x%p fb image", el->enmBuffer, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 211 209 212 switch (el->enmFormat) 213 { 214 case GL_DEPTH_COMPONENT: 215 if (to->pixel.depthScale != 1.0f) 216 { 217 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 218 } 219 if (to->pixel.depthBias != 0.0f) 220 { 221 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 222 } 223 if (!to->buffer.depthTest) 224 { 225 diff_api.Disable(GL_DEPTH_TEST); 226 } 227 break; 228 case GL_STENCIL_INDEX: 229 if (to->pixel.indexOffset) 230 { 231 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 232 } 233 if (to->pixel.indexShift) 234 { 235 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 236 } 237 if (to->pixel.mapStencil) 238 { 239 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 240 } 241 if (!to->stencil.stencilTest) 242 { 243 diff_api.Disable(GL_STENCIL_TEST); 244 } 245 break; 246 default: 247 break; 210 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 211 { 212 if (to->pixel.depthScale != 1.0f) 213 { 214 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 215 } 216 if (to->pixel.depthBias != 0.0f) 217 { 218 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 219 } 220 if (!to->buffer.depthTest) 221 { 222 diff_api.Disable(GL_DEPTH_TEST); 223 } 224 } 225 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 226 { 227 if (to->pixel.indexOffset) 228 { 229 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 230 } 231 if (to->pixel.indexShift) 232 { 233 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 234 } 235 if (to->pixel.mapStencil) 236 { 237 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 238 } 239 if (!to->stencil.stencilTest) 240 { 241 diff_api.Disable(GL_STENCIL_TEST); 242 } 248 243 } 249 244 } … … 313 308 { 314 309 CRFBDataElement *el = &data->aElements[i]; 315 316 switch (el->enmFormat) 317 { 318 case GL_DEPTH_COMPONENT: 319 diff_api.Enable(GL_DEPTH_TEST); 320 if (to->pixel.depthScale != 1.0f) 321 { 322 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 323 } 324 if (to->pixel.depthBias != 0.0f) 325 { 326 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 327 } 328 break; 329 case GL_STENCIL_INDEX: 330 diff_api.Enable(GL_STENCIL_TEST); 331 if (to->pixel.mapStencil) 332 { 333 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 334 } 335 if (to->pixel.indexOffset) 336 { 337 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 338 } 339 if (to->pixel.indexShift) 340 { 341 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 342 } 343 break; 344 default: 345 break; 346 } 347 310 char fname[200]; 311 sprintf(fname, "./img_apply_%p_%d_%d.tga", to, i, el->enmFormat); 312 crDumpNamedTGA(fname, el->width, el->height, el->pvData); 313 314 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 315 { 316 diff_api.Enable(GL_DEPTH_TEST); 317 if (to->pixel.depthScale != 1.0f) 318 { 319 diff_api.PixelTransferf (GL_DEPTH_SCALE, 1.0f); 320 } 321 if (to->pixel.depthBias != 0.0f) 322 { 323 diff_api.PixelTransferf (GL_DEPTH_BIAS, 0.0f); 324 } 325 } 326 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 327 { 328 diff_api.Enable(GL_STENCIL_TEST); 329 if (to->pixel.mapStencil) 330 { 331 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_FALSE); 332 } 333 if (to->pixel.indexOffset) 334 { 335 diff_api.PixelTransferi (GL_INDEX_OFFSET, 0); 336 } 337 if (to->pixel.indexShift) 338 { 339 diff_api.PixelTransferi (GL_INDEX_SHIFT, 0); 340 } 341 } 348 342 349 343 diff_api.BindFramebufferEXT(GL_DRAW_FRAMEBUFFER, el->idFBO); … … 356 350 crDebug("Applied %d;%d;%d;%d;%d;0x%p fb image", el->enmBuffer, el->width, el->height, el->enmFormat, el->enmType, el->pvData); 357 351 358 switch (el->enmFormat) 359 { 360 case GL_DEPTH_COMPONENT: 361 if (to->pixel.depthScale != 1.0f) 362 { 363 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 364 } 365 if (to->pixel.depthBias != 0.0f) 366 { 367 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 368 } 369 diff_api.Disable(GL_DEPTH_TEST); 370 break; 371 case GL_STENCIL_INDEX: 372 if (to->pixel.indexOffset) 373 { 374 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 375 } 376 if (to->pixel.indexShift) 377 { 378 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 379 } 380 if (to->pixel.mapStencil) 381 { 382 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 383 } 384 diff_api.Disable(GL_STENCIL_TEST); 385 break; 386 default: 387 break; 352 if (el->enmFormat == GL_DEPTH_COMPONENT || el->enmFormat == GL_DEPTH_STENCIL) 353 { 354 if (to->pixel.depthScale != 1.0f) 355 { 356 diff_api.PixelTransferf (GL_DEPTH_SCALE, to->pixel.depthScale); 357 } 358 if (to->pixel.depthBias != 0.0f) 359 { 360 diff_api.PixelTransferf (GL_DEPTH_BIAS, to->pixel.depthBias); 361 } 362 diff_api.Disable(GL_DEPTH_TEST); 363 } 364 if (el->enmFormat == GL_STENCIL_INDEX || el->enmFormat == GL_DEPTH_STENCIL) 365 { 366 if (to->pixel.indexOffset) 367 { 368 diff_api.PixelTransferi (GL_INDEX_OFFSET, to->pixel.indexOffset); 369 } 370 if (to->pixel.indexShift) 371 { 372 diff_api.PixelTransferi (GL_INDEX_SHIFT, to->pixel.indexShift); 373 } 374 if (to->pixel.mapStencil) 375 { 376 diff_api.PixelTransferi (GL_MAP_STENCIL, GL_TRUE); 377 } 378 diff_api.Disable(GL_STENCIL_TEST); 388 379 } 389 380 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_main.c
r44802 r44816 1012 1012 } 1013 1013 1014 static int crVBoxServerFBImageDataInitEx(CRFBData *pData, CRContextInfo *pCtxInfo, CRMuralInfo *pMural, GLboolean fWrite, GLboolean fForceBackFrontOnly, GLuint overrideWidth, GLuint overrideHeight)1014 static int crVBoxServerFBImageDataInitEx(CRFBData *pData, CRContextInfo *pCtxInfo, CRMuralInfo *pMural, GLboolean fWrite, uint32_t version, GLuint overrideWidth, GLuint overrideHeight) 1015 1015 { 1016 1016 CRContext *pContext; … … 1026 1026 1027 1027 pContext = pCtxInfo->pContext; 1028 1029 /* the version should be always actual when we do reads, 1030 * i.e. it could differ on writes when snapshot is getting loaded */ 1031 CRASSERT(fWrite || version == SHCROGL_SSM_VERSION); 1028 1032 1029 1033 width = overrideWidth ? overrideWidth : pMural->width; … … 1057 1061 /* there is a lot of code that assumes we have double buffering, just assert here to print a warning in the log 1058 1062 * so that we know that something irregular is going on */ 1059 CRASSERT(pCtxInfo->CreateInfo.visualBits && CR_DOUBLE_BIT); 1060 if ((pCtxInfo->CreateInfo.visualBits && CR_DOUBLE_BIT) || fForceBackFrontOnly) 1063 CRASSERT(pCtxInfo->CreateInfo.visualBits & CR_DOUBLE_BIT); 1064 if ((pCtxInfo->CreateInfo.visualBits & CR_DOUBLE_BIT) 1065 || version < SHCROGL_SSM_VERSION_WITH_SINGLE_DEPTH_STENCIL /* <- older version had a typo which lead to back always being used, 1066 * no matter what the visual bits are */ 1067 ) 1061 1068 { 1062 1069 pEl = &pData->aElements[pData->cElements]; … … 1080 1087 } 1081 1088 1082 if (!fForceBackFrontOnly) 1083 { 1084 if (pCtxInfo->CreateInfo.visualBits && CR_DEPTH_BIT) 1089 if (version < SHCROGL_SSM_VERSION_WITH_SAVED_DEPTH_STENCIL_BUFFER) 1090 return VINF_SUCCESS; 1091 1092 1093 if (version < SHCROGL_SSM_VERSION_WITH_SINGLE_DEPTH_STENCIL) 1094 { 1095 /* if (pCtxInfo->CreateInfo.visualBits & CR_DEPTH_BIT) */ /* <- older version had a typo which lead to back always being used, 1096 * no matter what the visual bits are */ 1085 1097 { 1086 1098 AssertCompile(sizeof (GLfloat) == 4); … … 1112 1124 } 1113 1125 1114 if (pCtxInfo->CreateInfo.visualBits && CR_STENCIL_BIT) 1126 /* if (pCtxInfo->CreateInfo.visualBits & CR_STENCIL_BIT) */ /* <- older version had a typo which lead to back always being used, 1127 * no matter what the visual bits are */ 1115 1128 { 1116 1129 AssertCompile(sizeof (GLuint) == 4); … … 1134 1147 ++pData->cElements; 1135 1148 } 1149 return VINF_SUCCESS; 1150 } 1151 1152 if ((pCtxInfo->CreateInfo.visualBits & CR_STENCIL_BIT) 1153 || (pCtxInfo->CreateInfo.visualBits & CR_DEPTH_BIT)) 1154 { 1155 pEl = &pData->aElements[pData->cElements]; 1156 pEl->idFBO = pMural->fUseFBO ? pMural->aidFBOs[CR_SERVER_FBO_FB_IDX(pMural)] : 0; 1157 pEl->enmBuffer = 0; /* we do not care */ 1158 pEl->posX = 0; 1159 pEl->posY = 0; 1160 pEl->width = width; 1161 pEl->height = height; 1162 pEl->enmFormat = GL_DEPTH_STENCIL; 1163 pEl->enmType = GL_UNSIGNED_INT_24_8; 1164 pEl->cbData = width * height * 4; 1165 pEl->pvData = crCalloc(pEl->cbData); 1166 if (!pEl->pvData) 1167 { 1168 crVBoxServerFBImageDataTerm(pData); 1169 crWarning("crVBoxServerFBImageDataInit: crCalloc failed"); 1170 return VERR_NO_MEMORY; 1171 } 1172 ++pData->cElements; 1136 1173 } 1137 1174 return VINF_SUCCESS; … … 1140 1177 static int crVBoxServerFBImageDataInit(CRFBData *pData, CRContextInfo *pCtxInfo, CRMuralInfo *pMural, GLboolean fWrite) 1141 1178 { 1142 return crVBoxServerFBImageDataInitEx(pData, pCtxInfo, pMural, fWrite, GL_FALSE, 0, 0);1179 return crVBoxServerFBImageDataInitEx(pData, pCtxInfo, pMural, fWrite, SHCROGL_SSM_VERSION, 0, 0); 1143 1180 } 1144 1181 … … 1692 1729 return VINF_SUCCESS; 1693 1730 1694 rc = crVBoxServerFBImageDataInit (&Data.data, pContextInfo, pMural, GL_TRUE);1731 rc = crVBoxServerFBImageDataInitEx(&Data.data, pContextInfo, pMural, GL_TRUE, version, 0, 0); 1695 1732 if (!RT_SUCCESS(rc)) 1696 1733 { … … 1719 1756 return VINF_SUCCESS; 1720 1757 1721 rc = crVBoxServerFBImageDataInitEx(&Data.data, pContextInfo, pMural, GL_TRUE, GL_TRUE, storedWidth, storedHeight);1758 rc = crVBoxServerFBImageDataInitEx(&Data.data, pContextInfo, pMural, GL_TRUE, version, storedWidth, storedHeight); 1722 1759 if (!RT_SUCCESS(rc)) 1723 1760 {
Note:
See TracChangeset
for help on using the changeset viewer.