Changeset 41109 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker
- Timestamp:
- May 2, 2012 8:37:46 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 77709
- Location:
- trunk/src/VBox/GuestHost/OpenGL/state_tracker
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
r41057 r41109 52 52 * Callback used for crFreeHashtable(). 53 53 */ 54 static void 55 DeleteTextureCallback(void *texObj)54 DECLEXPORT(void) 55 crStateDeleteTextureCallback(void *texObj) 56 56 { 57 57 #ifndef IN_GUEST … … 74 74 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx); 75 75 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 76 crHashtableDelete(pData->s->textureTable, key, DeleteTextureCallback);76 crHashtableDelete(pData->s->textureTable, key, crStateDeleteTextureCallback); 77 77 } 78 78 … … 116 116 gSharedState = NULL; 117 117 } 118 crFreeHashtable(s->textureTable, DeleteTextureCallback);118 crFreeHashtable(s->textureTable, crStateDeleteTextureCallback); 119 119 crFreeHashtable(s->dlistTable, crFree); /* call crFree for each entry */ 120 120 crFreeHashtable(s->buffersTable, crStateFreeBufferObject); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r41057 r41109 688 688 } 689 689 690 static void crStateCleanupTextureRefs(CRContext *g, CRTextureObj *tObj) 691 { 692 CRTextureState *t = &(g->texture); 693 GLuint u; 694 695 /* 696 ** reset back to the base texture. 697 */ 698 for (u = 0; u < g->limits.maxTextureUnits; u++) 699 { 700 if (tObj == t->unit[u].currentTexture1D) 701 { 702 t->unit[u].currentTexture1D = &(t->base1D); 703 } 704 if (tObj == t->unit[u].currentTexture2D) 705 { 706 t->unit[u].currentTexture2D = &(t->base2D); 707 } 708 #ifdef CR_OPENGL_VERSION_1_2 709 if (tObj == t->unit[u].currentTexture3D) 710 { 711 t->unit[u].currentTexture3D = &(t->base3D); 712 } 713 #endif 714 #ifdef CR_ARB_texture_cube_map 715 if (tObj == t->unit[u].currentTextureCubeMap) 716 { 717 t->unit[u].currentTextureCubeMap = &(t->baseCubeMap); 718 } 719 #endif 720 #ifdef CR_NV_texture_rectangle 721 if (tObj == t->unit[u].currentTextureRect) 722 { 723 t->unit[u].currentTextureRect = &(t->baseRect); 724 } 725 #endif 726 727 #ifdef CR_EXT_framebuffer_object 728 crStateTextureCheckFBOAPs(GL_DRAW_FRAMEBUFFER, tObj->id); 729 crStateTextureCheckFBOAPs(GL_READ_FRAMEBUFFER, tObj->id); 730 #endif 731 } 732 733 } 734 690 735 void STATE_APIENTRY crStateDeleteTextures(GLsizei n, const GLuint *textures) 691 736 { … … 719 764 if (name && tObj) 720 765 { 721 GLuint u; 722 /* remove from hashtable */ 723 crHashtableDelete(g->shared->textureTable, name, NULL); 724 725 /* if the currentTexture is deleted, 726 ** reset back to the base texture. 727 */ 728 for (u = 0; u < g->limits.maxTextureUnits; u++) 729 { 730 if (tObj == t->unit[u].currentTexture1D) 731 { 732 t->unit[u].currentTexture1D = &(t->base1D); 733 } 734 if (tObj == t->unit[u].currentTexture2D) 735 { 736 t->unit[u].currentTexture2D = &(t->base2D); 737 } 738 #ifdef CR_OPENGL_VERSION_1_2 739 if (tObj == t->unit[u].currentTexture3D) 740 { 741 t->unit[u].currentTexture3D = &(t->base3D); 742 } 743 #endif 744 #ifdef CR_ARB_texture_cube_map 745 if (tObj == t->unit[u].currentTextureCubeMap) 746 { 747 t->unit[u].currentTextureCubeMap = &(t->baseCubeMap); 748 } 749 #endif 750 #ifdef CR_NV_texture_rectangle 751 if (tObj == t->unit[u].currentTextureRect) 752 { 753 t->unit[u].currentTextureRect = &(t->baseRect); 754 } 755 #endif 756 } 757 758 #ifdef CR_EXT_framebuffer_object 759 crStateTextureCheckFBOAPs(GL_DRAW_FRAMEBUFFER, name); 760 crStateTextureCheckFBOAPs(GL_READ_FRAMEBUFFER, name); 761 #endif 762 crStateDeleteTextureObject(tObj); 766 crStateCleanupTextureRefs(g, tObj); 767 768 crHashtableDelete(g->shared->textureTable, name, crStateDeleteTextureObject); 763 769 } 764 770 } … … 834 840 if (g->transform.matrixMode == GL_TEXTURE) { 835 841 crStateMatrixMode(GL_TEXTURE); 842 } 843 } 844 845 DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used) 846 { 847 CRContext *g = GetCurrentContext(); 848 CRTextureObj *tobj; 849 850 if (!texture) 851 { 852 crWarning("crStateSetTextureUsed: null texture name specified!"); 853 return; 854 } 855 856 GET_TOBJ(tobj, g, texture); 857 if (!tobj) 858 { 859 crWarning("crStateSetTextureUsed: failed to fined a HW name for texture(%d)!", texture); 860 return; 861 } 862 863 if (used) 864 CR_STATE_SHAREDOBJ_USAGE_SET(tobj, g); 865 else 866 { 867 CRStateBits *sb = GetCurrentBits(); 868 CRTextureBits *tb = &(sb->texture); 869 CRTextureState *t = &(g->texture); 870 871 CR_STATE_SHAREDOBJ_USAGE_CLEAR(tobj, g); 872 873 crStateCleanupTextureRefs(g, tobj); 874 875 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(tobj)) 876 crHashtableDelete(g->shared->textureTable, texture, crStateDeleteTextureCallback); 877 878 DIRTY(tb->dirty, g->neg_bitid); 879 DIRTY(tb->current[t->curTextureUnit], g->neg_bitid); 836 880 } 837 881 }
Note:
See TracChangeset
for help on using the changeset viewer.