Changeset 33280 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Oct 21, 2010 3:48:26 AM (14 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_misc.c
r33093 r33280 270 270 } 271 271 272 /*#define CR_DUMP_BLITS*/ 273 274 #ifdef CR_DUMP_BLITS 275 static int blitnum=0; 276 static int copynum=0; 277 #endif 278 272 279 void SERVER_DISPATCH_APIENTRY 273 280 crServerDispatchCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) … … 280 287 { 281 288 cr_server.head_spu->dispatch_table.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 289 290 #ifdef CR_DUMP_BLITS 291 { 292 SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table; 293 void *img; 294 GLint w, h; 295 char fname[200]; 296 297 copynum++; 298 299 gl->GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w); 300 gl->GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h); 301 302 img = crAlloc(w*h*4); 303 CRASSERT(img); 304 305 gl->GetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, img); 306 sprintf(fname, "copy_blit%i_copy_%i.tga", blitnum, copynum); 307 crDumpNamedTGA(fname, w, h, img); 308 crFree(img); 309 } 310 #endif 282 311 } 283 312 else /* negative height, means we have to Yinvert the source pixels while copying */ … … 471 500 } 472 501 } 502 503 void SERVER_DISPATCH_APIENTRY 504 crServerDispatchBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, 505 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, 506 GLbitfield mask, GLenum filter) 507 { 508 #ifdef CR_DUMP_BLITS 509 SPUDispatchTable *gl = &cr_server.head_spu->dispatch_table; 510 GLint rfb=0, dfb=0, dtex=0, dlev=-1, rb=0, db=0, ppb=0, pub=0, vp[4], otex, dstw, dsth; 511 GLenum status; 512 char fname[200]; 513 void *img; 514 515 blitnum++; 516 517 crDebug("[%i]BlitFramebufferEXT(%i, %i, %i, %i, %i, %i, %i, %i, %x, %x)", blitnum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); 518 crDebug("%i, %i <-> %i, %i", srcX1-srcX0, srcY1-srcY0, dstX1-dstX0, dstY1-dstY0); 519 520 gl->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &rfb); 521 gl->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &dfb); 522 gl->GetIntegerv(GL_READ_BUFFER, &rb); 523 gl->GetIntegerv(GL_DRAW_BUFFER, &db); 524 525 gl->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, &ppb); 526 gl->GetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, &pub); 527 528 gl->GetIntegerv(GL_VIEWPORT, &vp[0]); 529 530 gl->GetIntegerv(GL_TEXTURE_BINDING_2D, &otex); 531 532 CRASSERT(!rfb && dfb); 533 gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, &dtex); 534 gl->GetFramebufferAttachmentParameterivEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, &dlev); 535 status = gl->CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT); 536 537 CRASSERT(status==GL_FRAMEBUFFER_COMPLETE_EXT 538 && db==GL_COLOR_ATTACHMENT0_EXT 539 && (rb==GL_FRONT || rb==GL_BACK) 540 && !rfb && dfb && dtex && !dlev 541 && !ppb && !pub); 542 543 crDebug("Src[rb 0x%x, fbo %i] Dst[db 0x%x, fbo %i(0x%x), tex %i.%i]", rb, rfb, db, dfb, status, dtex, dlev); 544 crDebug("Viewport [%i, %i, %i, %i]", vp[0], vp[1], vp[2], vp[3]); 545 546 gl->PixelStorei(GL_PACK_ROW_LENGTH, 0); 547 gl->PixelStorei(GL_PACK_ALIGNMENT, 1); 548 gl->PixelStorei(GL_PACK_SKIP_PIXELS, 0); 549 gl->PixelStorei(GL_PACK_SKIP_ROWS, 0); 550 551 gl->PixelStorei(GL_UNPACK_ROW_LENGTH, 0); 552 gl->PixelStorei(GL_UNPACK_ALIGNMENT, 1); 553 gl->PixelStorei(GL_UNPACK_SKIP_PIXELS, 0); 554 gl->PixelStorei(GL_UNPACK_SKIP_ROWS, 0); 555 556 gl->BindTexture(GL_TEXTURE_2D, dtex); 557 gl->GetTexLevelParameteriv(GL_TEXTURE_2D, dlev, GL_TEXTURE_WIDTH, &dstw); 558 gl->GetTexLevelParameteriv(GL_TEXTURE_2D, dlev, GL_TEXTURE_HEIGHT, &dsth); 559 gl->BindTexture(GL_TEXTURE_2D, otex); 560 crDebug("Dst is %i, %i", dstw, dsth); 561 562 CRASSERT(vp[2]>=dstw && vp[3]>=dsth); 563 img = crAlloc(vp[2]*vp[3]*4); 564 CRASSERT(img); 565 566 gl->ReadPixels(0, 0, vp[2], vp[3], GL_BGRA, GL_UNSIGNED_BYTE, img); 567 sprintf(fname, "blit%iA_src.tga", blitnum); 568 crDumpNamedTGA(fname, vp[2], vp[3], img); 569 570 gl->BindTexture(GL_TEXTURE_2D, dtex); 571 gl->GetTexImage(GL_TEXTURE_2D, dlev, GL_BGRA, GL_UNSIGNED_BYTE, img); 572 sprintf(fname, "blit%iB_dst.tga", blitnum); 573 crDumpNamedTGA(fname, dstw, dsth, img); 574 gl->BindTexture(GL_TEXTURE_2D, otex); 575 #endif 576 577 cr_server.head_spu->dispatch_table.BlitFramebufferEXT(srcX0, srcY0, srcX1, srcY1, 578 dstX0, dstY0, dstX1, dstY1, 579 mask, filter); 580 581 #ifdef CR_DUMP_BLITS 582 gl->BindTexture(GL_TEXTURE_2D, dtex); 583 gl->GetTexImage(GL_TEXTURE_2D, dlev, GL_BGRA, GL_UNSIGNED_BYTE, img); 584 sprintf(fname, "blit%iC_res.tga", blitnum); 585 crDumpNamedTGA(fname, dstw, dsth, img); 586 gl->BindTexture(GL_TEXTURE_2D, otex); 587 crFree(img); 588 #endif 589 } -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/server_special
r33045 r33280 245 245 GetObjectParameterivARB 246 246 GetObjectParameterfvARB 247 BlitFramebufferEXT
Note:
See TracChangeset
for help on using the changeset viewer.