Changeset 41109 in vbox for trunk/src/VBox/GuestHost/OpenGL
- Timestamp:
- May 2, 2012 8:37:46 AM (13 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/chromium.h
r38143 r41109 21 21 #include "cr_compiler.h" 22 22 23 #ifdef IN_RING0 24 #include <common/VBoxMPUtils.h> 25 #define WINGDIAPI 26 #endif 23 27 /* 24 28 * We effectively wrap gl.h, glu.h, etc, just like GLUT … … 30 34 31 35 #if defined(WINDOWS) 36 # ifdef IN_RING0 37 # error "should not happen!" 38 # endif 32 39 #define WIN32_LEAN_AND_MEAN 33 40 #define WGL_APIENTRY __stdcall … … 36 43 /* nothing */ 37 44 #else 38 #define GLX 45 # ifndef IN_RING0 46 # define GLX 47 # endif 39 48 #endif 40 49 … … 688 697 /*Global resource ids sharing*/ 689 698 #define GL_SHARE_CONTEXT_RESOURCES_CR 0x8B27 699 /*do flush for the command buffer of a thread the context was previusly current for*/ 690 700 #define GL_FLUSH_ON_THREAD_SWITCH_CR 0x8B28 701 /*report that the shared resource is used by this context, the parameter value is a texture name*/ 702 #define GL_RCUSAGE_TEXTURE_SET_CR 0x8B29 703 /*report that the shared resource is no longer used by this context, the parameter value is a texture name*/ 704 #define GL_RCUSAGE_TEXTURE_CLEAR_CR 0x8B2A 691 705 692 706 /**********************************************************************/ -
trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h
r41071 r41109 60 60 # define CR_STATE_SHAREDOBJ_USAGE_CLEAR(_pObj, _pCtx) (ASMBitClear((_pObj)->ctxUsage, (_pCtx)->id)) 61 61 # define CR_STATE_SHAREDOBJ_USAGE_IS_USED(_pObj) (ASMBitFirstSet((_pObj)->ctxUsage, sizeof ((_pObj)->ctxUsage)<<3) >= 0) 62 #else 63 # define CR_STATE_SHAREDOBJ_USAGE_INIT(_pObj) do {} while (0) 64 # define CR_STATE_SHAREDOBJ_USAGE_SET(_pObj, _pCtx) do {} while (0) 65 # define CR_STATE_SHAREDOBJ_USAGE_CLEAR(_pObj, _pCtx) do {} while (0) 66 # define CR_STATE_SHAREDOBJ_USAGE_IS_USED(_pObj) (GL_FALSE) 62 67 #endif 63 68 … … 237 242 DECLEXPORT(int32_t) crStateLoadContext(CRContext *pContext, CRHashTable * pCtxTable, PFNCRSTATE_CONTEXT_GET pfnCtxGet, PSSMHANDLE pSSM); 238 243 DECLEXPORT(void) crStateFreeShared(CRContext *pContext, CRSharedState *s); 239 #endif 240 244 DECLEXPORT(void) crStateFreeShared(CRContext *pContext, CRSharedState *s); 245 #endif 246 247 DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used); 248 DECLEXPORT(void) crStateDeleteTextureCallback(void *texObj); 241 249 242 250 /* XXX move these! */ -
trunk/src/VBox/GuestHost/OpenGL/include/cr_pack.h
r39265 r41109 73 73 int swapping; 74 74 CRPackBuffer *currentBuffer; 75 #ifdef CHROMIUM_THREADSAFE 75 76 CRmutex mutex; 77 #endif 76 78 char *file; /**< for debugging only */ 77 79 int line; /**< for debugging only */ … … 149 151 #define CR_LOCK_PACKER_CONTEXT(PC) crLockMutex(&((PC)->mutex)) 150 152 #define CR_UNLOCK_PACKER_CONTEXT(PC) crUnlockMutex(&((PC)->mutex)) 151 #el se153 #elif !defined IN_RING0 152 154 extern DLLDATA(CRPackContext) cr_packer_globals; 153 155 #define CR_GET_PACKER_CONTEXT(C) CRPackContext *C = &cr_packer_globals -
trunk/src/VBox/GuestHost/OpenGL/packer/pack_buffer.c
r34358 r41109 10 10 #include "cr_error.h" 11 11 #include "cr_protocol.h" 12 #ifndef IN_RING0 12 13 #include "cr_unpack.h" 13 14 14 #endif 15 16 #ifndef IN_RING0 15 17 void crWriteUnalignedDouble( void *buffer, double d ) 16 18 { … … 35 37 return d; 36 38 } 37 39 #endif 38 40 /* 39 41 * We need the packer to run as efficiently as possible. To avoid one … … 72 74 } 73 75 76 #ifndef IN_RING0 74 77 /* This is useful for debugging packer problems */ 75 78 void crPackSetBufferDEBUG( const char *file, int line, … … 82 85 pc->line = line; 83 86 } 84 87 #endif 85 88 86 89 /* -
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.