- 時間撮記:
- 2013-2-25 下午12:50:56 (12 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
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 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器