- 時間撮記:
- 2012-12-7 上午10:34:42 (12 年 以前)
- 位置:
- trunk/src/VBox/GuestHost/OpenGL/state_tracker
- 檔案:
-
- 修改 5 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state.h
r39602 r44059 9 9 10 10 #include "cr_glstate.h" 11 12 #define CRSTATE_CHECKERR_RET(expr, result, message, ret) \ 13 if (expr) { \ 14 crStateError(__LINE__, __FILE__, result, message); \ 15 return ret; \ 16 } 17 18 #define CRSTATE_NO_RETURN 19 20 #define CRSTATE_CHECKERR(expr, result, message) CRSTATE_CHECKERR_RET(expr, result, message, CRSTATE_NO_RETURN) 11 21 12 22 typedef struct _crCheckIDHWID { … … 62 72 void crStateFreeFBO(void *data); 63 73 void crStateFreeRBO(void *data); 74 75 void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names); 64 76 #endif -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c
r44052 r44059 30 30 } 31 31 32 void STATE_APIENTRY crStateGenBuffersARB(GLsizei n, GLuint *buffers) 33 { 34 CRContext *g = GetCurrentContext(); 35 crStateGenNames(g, g->shared->buffersTable, n, buffers); 36 } 37 32 38 GLboolean crStateIsBufferBound(GLenum target) 33 39 { … … 185 191 newObj = (CRBufferObject *) crHashtableSearch(g->shared->buffersTable, buffer); 186 192 if (!newObj) { 193 CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->buffersTable, buffer), GL_INVALID_OPERATION, "name is not a buffer object"); 187 194 newObj = AllocBufferObject(buffer); 188 if (!newObj) { 189 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, "glBindBuffer"); 195 CRSTATE_CHECKERR(!newObj, GL_OUT_OF_MEMORY, "glBindBuffer"); 196 #ifndef IN_GUEST 197 diff_api.GenBuffersARB(1, &newObj->hwid); 198 if (!newObj->hwid) 199 { 200 crWarning("GenBuffersARB failed!"); 201 crFree(newObj); 190 202 return; 191 203 } 204 #endif 192 205 crHashtableAdd( g->shared->buffersTable, buffer, newObj ); 193 206 } … … 334 347 } 335 348 336 337 void STATE_APIENTRY338 crStateGenBuffersARB(GLsizei n, GLuint * buffers)339 {340 CRContext *g = GetCurrentContext();341 CRBufferObjectState *b = &(g->bufferobject);342 GLint start;343 344 FLUSH();345 346 if (g->current.inBeginEnd) {347 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION,348 "glGenBuffersARB called in Begin/End");349 return;350 }351 352 if (n < 0) {353 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE,354 "glGenBuffersARB(n < 0)");355 return;356 }357 358 start = crHashtableAllocKeys(g->shared->buffersTable, n);359 if (start) {360 GLint i;361 for (i = 0; i < n; i++)362 buffers[i] = (GLuint) (start + i);363 }364 else {365 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenBuffersARB");366 }367 }368 369 370 349 GLboolean STATE_APIENTRY 371 350 crStateIsBufferARB(GLuint buffer) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_framebuffer.c
r44053 r44059 23 23 #include "cr_mem.h" 24 24 25 #define CRSTATE_FBO_CHECKERR_RET(expr, result, message, ret) \26 if (expr) { \27 crStateError(__LINE__, __FILE__, result, message); \28 return ret; \29 }30 31 #define CRSTATE_NO_RETURN32 33 #define CRSTATE_FBO_CHECKERR(expr, result, message) CRSTATE_FBO_CHECKERR_RET(expr, result, message, CRSTATE_NO_RETURN)34 35 25 DECLEXPORT(void) STATE_APIENTRY 36 26 crStateFramebufferObjectInit(CRContext *ctx) … … 44 34 } 45 35 36 void STATE_APIENTRY crStateGenFramebuffersEXT(GLsizei n, GLuint *buffers) 37 { 38 CRContext *g = GetCurrentContext(); 39 crStateGenNames(g, g->shared->fbTable, n, buffers); 40 } 41 42 void STATE_APIENTRY crStateGenRenderbuffersEXT(GLsizei n, GLuint *buffers) 43 { 44 CRContext *g = GetCurrentContext(); 45 crStateGenNames(g, g->shared->rbTable, n, buffers); 46 } 47 48 static void crStateInitFrameBuffer(CRFramebufferObject *fbo); 49 50 static CRFramebufferObject * 51 crStateFramebufferAllocate(CRContext *ctx, GLuint name) 52 { 53 CRFramebufferObject *buffer = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject)); 54 CRSTATE_CHECKERR_RET(!buffer, GL_OUT_OF_MEMORY, "crStateFramebufferAllocate", NULL); 55 buffer->id = name; 56 #ifndef IN_GUEST 57 diff_api.GenFramebuffersEXT(1, &buffer->hwid); 58 if (!buffer->hwid) 59 { 60 crWarning("GenFramebuffersEXT failed!"); 61 crFree(buffer); 62 return NULL; 63 } 64 #else 65 buffer->hwid = name; 66 #endif 67 68 crStateInitFrameBuffer(buffer); 69 crHashtableAdd(ctx->shared->fbTable, name, buffer); 70 #ifndef IN_GUEST 71 CR_STATE_SHAREDOBJ_USAGE_INIT(buffer); 72 #endif 73 74 return buffer; 75 } 76 77 static CRRenderbufferObject * 78 crStateRenderbufferAllocate(CRContext *ctx, GLuint name) 79 { 80 CRRenderbufferObject *buffer = (CRRenderbufferObject*) crCalloc(sizeof(CRRenderbufferObject)); 81 CRSTATE_CHECKERR_RET(!buffer, GL_OUT_OF_MEMORY, "crStateRenderbufferAllocate", NULL); 82 buffer->id = name; 83 #ifndef IN_GUEST 84 diff_api.GenRenderbuffersEXT(1, &buffer->hwid); 85 if (!buffer->hwid) 86 { 87 crWarning("GenRenderbuffersEXT failed!"); 88 crFree(buffer); 89 return NULL; 90 } 91 #else 92 buffer->hwid = name; 93 #endif 94 95 buffer->internalformat = GL_RGBA; 96 crHashtableAdd(ctx->shared->rbTable, name, buffer); 97 #ifndef IN_GUEST 98 CR_STATE_SHAREDOBJ_USAGE_INIT(buffer); 99 #endif 100 101 return buffer; 102 } 103 46 104 void crStateFreeFBO(void *data) 47 105 { … … 88 146 CRFramebufferObjectState *fbo = &g->framebufferobject; 89 147 90 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");91 CRSTATE_ FBO_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target");148 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 149 CRSTATE_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 92 150 93 151 if (renderbuffer) … … 96 154 if (!fbo->renderbuffer) 97 155 { 98 fbo->renderbuffer = (CRRenderbufferObject*) crCalloc(sizeof(CRRenderbufferObject)); 99 CRSTATE_FBO_CHECKERR(!fbo->renderbuffer, GL_OUT_OF_MEMORY, "glBindRenderbufferEXT"); 100 fbo->renderbuffer->id = renderbuffer; 101 fbo->renderbuffer->hwid = renderbuffer; 102 fbo->renderbuffer->internalformat = GL_RGBA; 103 crHashtableAdd(g->shared->rbTable, renderbuffer, fbo->renderbuffer); 104 #ifndef IN_GUEST 105 CR_STATE_SHAREDOBJ_USAGE_INIT(fbo->renderbuffer); 106 #endif 156 CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->rbTable, renderbuffer), GL_INVALID_OPERATION, "name is not a renderbuffer"); 157 fbo->renderbuffer = crStateRenderbufferAllocate(g, renderbuffer); 107 158 } 108 159 #ifndef IN_GUEST … … 159 210 int i; 160 211 161 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");162 CRSTATE_ FBO_CHECKERR(n<0, GL_INVALID_OPERATION, "n<0");212 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 213 CRSTATE_CHECKERR(n<0, GL_INVALID_OPERATION, "n<0"); 163 214 164 215 for (i = 0; i < n; i++) … … 192 243 CRRenderbufferObject *rb = fbo->renderbuffer; 193 244 194 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");195 CRSTATE_ FBO_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target");196 CRSTATE_ FBO_CHECKERR(!rb, GL_INVALID_OPERATION, "no bound renderbuffer");245 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 246 CRSTATE_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 247 CRSTATE_CHECKERR(!rb, GL_INVALID_OPERATION, "no bound renderbuffer"); 197 248 198 249 rb->width = width; … … 208 259 CRRenderbufferObject *rb = fbo->renderbuffer; 209 260 210 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");211 CRSTATE_ FBO_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target");212 CRSTATE_ FBO_CHECKERR(!rb, GL_INVALID_OPERATION, "no bound renderbuffer");261 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 262 CRSTATE_CHECKERR(target!=GL_RENDERBUFFER_EXT, GL_INVALID_ENUM, "invalid target"); 263 CRSTATE_CHECKERR(!rb, GL_INVALID_OPERATION, "no bound renderbuffer"); 213 264 214 265 switch (pname) … … 229 280 case GL_RENDERBUFFER_DEPTH_SIZE_EXT: 230 281 case GL_RENDERBUFFER_STENCIL_SIZE_EXT: 231 CRSTATE_ FBO_CHECKERR(GL_TRUE, GL_INVALID_OPERATION, "unimplemented");282 CRSTATE_CHECKERR(GL_TRUE, GL_INVALID_OPERATION, "unimplemented"); 232 283 break; 233 284 default: 234 CRSTATE_ FBO_CHECKERR(GL_TRUE, GL_INVALID_ENUM, "invalid pname");285 CRSTATE_CHECKERR(GL_TRUE, GL_INVALID_ENUM, "invalid pname"); 235 286 } 236 287 } … … 291 342 CRFramebufferObject *pFBO=NULL; 292 343 293 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");294 CRSTATE_ FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)),344 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 345 CRSTATE_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 295 346 GL_INVALID_ENUM, "invalid target"); 296 347 … … 300 351 if (!pFBO) 301 352 { 302 pFBO = (CRFramebufferObject*) crCalloc(sizeof(CRFramebufferObject)); 303 CRSTATE_FBO_CHECKERR(!pFBO, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); 304 pFBO->id = framebuffer; 305 pFBO->hwid = framebuffer; 306 crStateInitFrameBuffer(pFBO); 307 crHashtableAdd(g->shared->fbTable, framebuffer, pFBO); 308 #ifndef IN_GUEST 309 CR_STATE_SHAREDOBJ_USAGE_INIT(pFBO); 310 #endif 353 CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->fbTable, framebuffer), GL_INVALID_OPERATION, "name is not a framebuffer"); 354 pFBO = crStateFramebufferAllocate(g, framebuffer); 311 355 } 312 356 … … 343 387 int i; 344 388 345 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");346 CRSTATE_ FBO_CHECKERR(n<0, GL_INVALID_OPERATION, "n<0");389 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 390 CRSTATE_CHECKERR(n<0, GL_INVALID_OPERATION, "n<0"); 347 391 348 392 for (i = 0; i < n; i++) … … 385 429 } 386 430 387 static GLuint crStateFramebufferTextureCheck(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, 388 CRFBOAttachmentPoint **aap, CRTextureObj **tobj) 389 { 390 CRContext *g = GetCurrentContext(); 391 CRFramebufferObjectState *fbo = &g->framebufferobject; 392 CRFramebufferObject *apFBOs[2]; 393 GLuint cPBOs = 0, i; 394 GLuint maxtexsizelog2; 395 396 397 CRSTATE_FBO_CHECKERR_RET(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end", 0); 398 CRSTATE_FBO_CHECKERR_RET(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 399 GL_INVALID_ENUM, "invalid target", 0); 431 static GLuint crStateFramebufferGet(CRFramebufferObjectState *fbo, GLenum target, CRFramebufferObject **apFBOs) 432 { 433 GLuint cPBOs = 0; 400 434 switch (target) 401 435 { … … 422 456 break; 423 457 default: 424 crWarning("unexpected dtarget value: 0x%x", target); 425 CRSTATE_FBO_CHECKERR_RET(1, GL_INVALID_ENUM, "unexpected target", 0); 426 break; 427 } 458 crWarning("unexpected target value: 0x%x", target); 459 cPBOs = 0; 460 break; 461 } 462 463 return cPBOs; 464 } 465 466 static GLuint crStateFramebufferTextureCheck(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, 467 CRFBOAttachmentPoint **aap, CRTextureObj **tobj) 468 { 469 CRContext *g = GetCurrentContext(); 470 CRFramebufferObjectState *fbo = &g->framebufferobject; 471 CRFramebufferObject *apFBOs[2]; 472 GLuint cPBOs = 0, i; 473 GLuint maxtexsizelog2; 474 475 476 CRSTATE_CHECKERR_RET(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end", 0); 477 CRSTATE_CHECKERR_RET(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 478 GL_INVALID_ENUM, "invalid target", 0); 479 480 cPBOs = crStateFramebufferGet(fbo, target, apFBOs); 481 CRSTATE_CHECKERR_RET(!cPBOs, GL_INVALID_ENUM, "unexpected target", 0); 428 482 429 483 Assert(cPBOs); … … 432 486 for (i = 0; i < cPBOs; ++i) 433 487 { 434 CRSTATE_ FBO_CHECKERR_RET(!apFBOs[i], GL_INVALID_OPERATION, "no fbo bound", 0);435 CRSTATE_ FBO_CHECKERR_RET(!crStateGetFBOAttachmentPoint(apFBOs[i], attachment, &aap[i]), GL_INVALID_ENUM, "invalid attachment", 0);488 CRSTATE_CHECKERR_RET(!apFBOs[i], GL_INVALID_OPERATION, "no fbo bound", 0); 489 CRSTATE_CHECKERR_RET(!crStateGetFBOAttachmentPoint(apFBOs[i], attachment, &aap[i]), GL_INVALID_ENUM, "invalid attachment", 0); 436 490 } 437 491 … … 466 520 break; 467 521 default: 468 CRSTATE_ FBO_CHECKERR_RET(GL_TRUE, GL_INVALID_OPERATION, "invalid textarget", 0);469 } 470 471 CRSTATE_ FBO_CHECKERR_RET(!*tobj, GL_INVALID_OPERATION, "invalid textarget/texture combo", 0);522 CRSTATE_CHECKERR_RET(GL_TRUE, GL_INVALID_OPERATION, "invalid textarget", 0); 523 } 524 525 CRSTATE_CHECKERR_RET(!*tobj, GL_INVALID_OPERATION, "invalid textarget/texture combo", 0); 472 526 473 527 if (GL_TEXTURE_RECTANGLE_ARB==textarget) 474 528 { 475 CRSTATE_ FBO_CHECKERR_RET(level!=0, GL_INVALID_VALUE, "non zero mipmap level", 0);476 } 477 478 CRSTATE_ FBO_CHECKERR_RET(level<0, GL_INVALID_VALUE, "level<0", 0);479 CRSTATE_ FBO_CHECKERR_RET(level>maxtexsizelog2, GL_INVALID_VALUE, "level too big", 0);529 CRSTATE_CHECKERR_RET(level!=0, GL_INVALID_VALUE, "non zero mipmap level", 0); 530 } 531 532 CRSTATE_CHECKERR_RET(level<0, GL_INVALID_VALUE, "level<0", 0); 533 CRSTATE_CHECKERR_RET(level>maxtexsizelog2, GL_INVALID_VALUE, "level too big", 0); 480 534 481 535 #ifdef IN_GUEST … … 516 570 } 517 571 518 CRSTATE_ FBO_CHECKERR(textarget!=GL_TEXTURE_1D, GL_INVALID_OPERATION, "textarget");572 CRSTATE_CHECKERR(textarget!=GL_TEXTURE_1D, GL_INVALID_OPERATION, "textarget"); 519 573 520 574 #ifndef IN_GUEST … … 552 606 } 553 607 554 CRSTATE_ FBO_CHECKERR(GL_TEXTURE_1D==textarget || GL_TEXTURE_3D==textarget, GL_INVALID_OPERATION, "textarget");608 CRSTATE_CHECKERR(GL_TEXTURE_1D==textarget || GL_TEXTURE_3D==textarget, GL_INVALID_OPERATION, "textarget"); 555 609 556 610 #ifndef IN_GUEST … … 592 646 } 593 647 594 CRSTATE_ FBO_CHECKERR(zoffset>(g->limits.max3DTextureSize-1), GL_INVALID_VALUE, "zoffset too big");595 CRSTATE_ FBO_CHECKERR(textarget!=GL_TEXTURE_3D, GL_INVALID_OPERATION, "textarget");648 CRSTATE_CHECKERR(zoffset>(g->limits.max3DTextureSize-1), GL_INVALID_VALUE, "zoffset too big"); 649 CRSTATE_CHECKERR(textarget!=GL_TEXTURE_3D, GL_INVALID_OPERATION, "textarget"); 596 650 597 651 #ifndef IN_GUEST … … 618 672 CRRenderbufferObject *rb; 619 673 620 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");621 CRSTATE_ FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)),674 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 675 CRSTATE_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 622 676 GL_INVALID_ENUM, "invalid target"); 623 677 pFBO = GL_READ_FRAMEBUFFER==target ? fbo->readFB : fbo->drawFB; 624 CRSTATE_ FBO_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound");625 CRSTATE_ FBO_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, &ap), GL_INVALID_ENUM, "invalid attachment");678 CRSTATE_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound"); 679 CRSTATE_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 626 680 627 681 if (!renderbuffer) … … 638 692 639 693 rb = (CRRenderbufferObject*) crHashtableSearch(g->shared->rbTable, renderbuffer); 640 CRSTATE_FBO_CHECKERR(!rb, GL_INVALID_OPERATION, "rb doesn't exist"); 694 if (!rb) 695 { 696 CRSTATE_CHECKERR(!crHashtableIsKeyUsed(g->shared->rbTable, renderbuffer), GL_INVALID_OPERATION, "rb doesn't exist"); 697 rb = crStateRenderbufferAllocate(g, renderbuffer); 698 } 641 699 642 700 #ifdef IN_GUEST … … 656 714 CRContext *g = GetCurrentContext(); 657 715 CRFramebufferObjectState *fbo = &g->framebufferobject; 658 CRFramebufferObject *pFBO; 716 CRFramebufferObject *apFBOs[2]; 717 GLint cFBOs = 0, i; 659 718 CRFBOAttachmentPoint *ap; 660 719 661 CRSTATE_ FBO_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end");662 CRSTATE_ FBO_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)),720 CRSTATE_CHECKERR(g->current.inBeginEnd, GL_INVALID_OPERATION, "called in begin/end"); 721 CRSTATE_CHECKERR(((target!=GL_FRAMEBUFFER_EXT) && (target!=GL_READ_FRAMEBUFFER) && (target!=GL_DRAW_FRAMEBUFFER)), 663 722 GL_INVALID_ENUM, "invalid target"); 664 pFBO = GL_READ_FRAMEBUFFER==target ? fbo->readFB : fbo->drawFB; 665 CRSTATE_FBO_CHECKERR(!pFBO, GL_INVALID_OPERATION, "no fbo bound"); 666 CRSTATE_FBO_CHECKERR(!crStateGetFBOAttachmentPoint(pFBO, attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 667 668 switch (pname) 669 { 670 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: 671 *params = ap->type; 672 break; 673 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: 674 CRSTATE_FBO_CHECKERR(ap->type!=GL_RENDERBUFFER_EXT && ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "can't query object name when it's not bound") 675 *params = ap->name; 676 break; 677 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: 678 CRSTATE_FBO_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 679 *params = ap->level; 680 break; 681 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: 682 CRSTATE_FBO_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 683 *params = ap->face; 684 break; 685 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: 686 CRSTATE_FBO_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 687 *params = ap->zoffset; 688 break; 689 default: 690 CRSTATE_FBO_CHECKERR(GL_TRUE, GL_INVALID_ENUM, "invalid pname"); 691 } 723 724 cFBOs = crStateFramebufferGet(fbo, target, apFBOs); 725 726 CRSTATE_CHECKERR(!cFBOs, GL_INVALID_OPERATION, "no fbo bound"); 727 728 for (i = 0; i < cFBOs; ++i) 729 { 730 CRSTATE_CHECKERR(!crStateGetFBOAttachmentPoint(apFBOs[i], attachment, &ap), GL_INVALID_ENUM, "invalid attachment"); 731 732 switch (pname) 733 { 734 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: 735 *params = ap->type; 736 break; 737 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT: 738 CRSTATE_CHECKERR(ap->type!=GL_RENDERBUFFER_EXT && ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "can't query object name when it's not bound") 739 *params = ap->name; 740 break; 741 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT: 742 CRSTATE_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 743 *params = ap->level; 744 break; 745 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT: 746 CRSTATE_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 747 *params = ap->face; 748 break; 749 case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT: 750 CRSTATE_CHECKERR(ap->type!=GL_TEXTURE, GL_INVALID_ENUM, "not a texture"); 751 *params = ap->zoffset; 752 break; 753 default: 754 CRSTATE_CHECKERR(GL_TRUE, GL_INVALID_ENUM, "invalid pname"); 755 } 756 } 757 } 758 759 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsFramebufferEXT( GLuint framebuffer ) 760 { 761 CRContext *g = GetCurrentContext(); 762 return crHashtableIsKeyUsed(g->shared->fbTable, framebuffer); 763 } 764 765 DECLEXPORT(GLboolean) STATE_APIENTRY crStateIsRenderbufferEXT( GLuint renderbuffer ) 766 { 767 CRContext *g = GetCurrentContext(); 768 return crHashtableIsKeyUsed(g->shared->rbTable, renderbuffer); 692 769 } 693 770 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_special
r25154 r44059 376 376 GetUniformLocation 377 377 CopyTexImage2D 378 GenFramebuffersEXT 379 GenRenderbuffersEXT 380 GenBuffersARB 381 IsRenderbufferEXT 382 IsFramebufferEXT -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r41313 r44059 621 621 } 622 622 623 void STATE_APIENTRY crStateGenTextures(GLsizei n, GLuint *textures) 624 { 625 CRContext *g = GetCurrentContext(); 623 void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names) 624 { 626 625 GLint start; 627 626 … … 631 630 { 632 631 crStateError(__LINE__, __FILE__, GL_INVALID_OPERATION, 633 " glGenTextures called in Begin/End");632 "crStateGenNames called in Begin/End"); 634 633 return; 635 634 } … … 638 637 { 639 638 crStateError(__LINE__, __FILE__, GL_INVALID_VALUE, 640 "Negative n passed to glGenTextures: %d", n);641 return; 642 } 643 644 start = crHashtableAllocKeys( g->shared->textureTable, n);639 "Negative n passed to crStateGenNames: %d", n); 640 return; 641 } 642 643 start = crHashtableAllocKeys(table, n); 645 644 if (start) 646 645 { 647 646 GLint i; 648 647 for (i = 0; i < n; i++) 649 textures[i] = (GLuint) (start + i);648 names[i] = (GLuint) (start + i); 650 649 } 651 650 else … … 653 652 crStateError(__LINE__, __FILE__, GL_OUT_OF_MEMORY, "glGenTextures"); 654 653 } 654 } 655 656 void STATE_APIENTRY crStateGenTextures(GLsizei n, GLuint *textures) 657 { 658 CRContext *g = GetCurrentContext(); 659 crStateGenNames(g, g->shared->textureTable, n, textures); 655 660 } 656 661
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器