Changeset 16074 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/array/arrayspu.c
- Timestamp:
- Jan 20, 2009 10:00:38 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/crOpenGL/array/arrayspu.c
r16036 r16074 13 13 ArraySPU array_spu; 14 14 15 #ifdef CHROMIUM_THREADSAFE 16 CRmutex _ArrayMutex; 17 #endif 18 15 19 static void ARRAYSPU_APIENTRY arrayspu_ArrayElement( GLint index ) 16 20 { 17 const CRClientState *c = &( array_spu.ctx->client);21 const CRClientState *c = &(crStateGetCurrent()->client); 18 22 const CRVertexArrays *array = &(c->array); 19 const GLboolean vpEnabled = array_spu.ctx->program.vpEnabled;23 const GLboolean vpEnabled = crStateGetCurrent()->program.vpEnabled; 20 24 unsigned char *p; 21 25 unsigned int unit, attr; … … 103 107 104 108 /* Now do conventional arrays, unless overriden by generic arrays above */ 105 for (unit = 0 ; unit < array_spu.ctx->limits.maxTextureUnits ; unit++)109 for (unit = 0 ; unit < crStateGetCurrent()->limits.maxTextureUnits ; unit++) 106 110 { 107 111 if (array->t[unit].enabled && !(vpEnabled && array->a[VERT_ATTRIB_TEX0+unit].enabled)) … … 450 454 GLubyte *p = (GLubyte *)indices; 451 455 #ifdef CR_ARB_vertex_buffer_object 452 CRBufferObject *elementsBuffer = array_spu.ctx->bufferobject.elementsBuffer;456 CRBufferObject *elementsBuffer = crStateGetCurrent()->bufferobject.elementsBuffer; 453 457 #endif 454 458 … … 622 626 { 623 627 if (cap == GL_VERTEX_PROGRAM_NV) { 624 array_spu.ctx->program.vpEnabled = GL_TRUE;628 crStateGetCurrent()->program.vpEnabled = GL_TRUE; 625 629 } 626 630 array_spu.child.Enable(cap); … … 631 635 { 632 636 if (cap == GL_VERTEX_PROGRAM_NV) { 633 array_spu.ctx->program.vpEnabled = GL_FALSE;637 crStateGetCurrent()->program.vpEnabled = GL_FALSE; 634 638 } 635 639 array_spu.child.Disable(cap); … … 754 758 } 755 759 760 static GLint ARRAYSPU_APIENTRY 761 arrayspu_CreateContext( const char *dpyName, GLint visual, GLint shareCtx ) 762 { 763 GLint ctx, slot; 764 765 #ifdef CHROMIUM_THREADSAFE 766 crLockMutex(&_ArrayMutex); 767 #endif 768 769 ctx = array_spu.child.CreateContext(dpyName, visual, shareCtx); 770 771 /* find an empty context slot */ 772 for (slot = 0; slot < array_spu.numContexts; slot++) { 773 if (!array_spu.context[slot].clientState) { 774 /* found empty slot */ 775 break; 776 } 777 } 778 if (slot == array_spu.numContexts) { 779 array_spu.numContexts++; 780 } 781 782 array_spu.context[slot].clientState = crStateCreateContext(NULL, visual, NULL); 783 array_spu.context[slot].clientCtx = ctx; 784 #ifdef CR_ARB_vertex_buffer_object 785 array_spu.context[slot].clientState->bufferobject.retainBufferData = GL_TRUE; 786 #endif 787 788 #ifdef CHROMIUM_THREADSAFE 789 crUnlockMutex(&_ArrayMutex); 790 #endif 791 792 return ctx; 793 } 794 795 static void ARRAYSPU_APIENTRY 796 arrayspu_MakeCurrent( GLint window, GLint nativeWindow, GLint ctx ) 797 { 798 #ifdef CHROMIUM_THREADSAFE 799 crLockMutex(&_ArrayMutex); 800 #endif 801 array_spu.child.MakeCurrent(window, nativeWindow, ctx); 802 803 if (ctx) { 804 int slot; 805 806 for (slot=0; slot<array_spu.numContexts; ++slot) 807 if (array_spu.context[slot].clientCtx == ctx) break; 808 CRASSERT(slot < array_spu.numContexts); 809 810 crStateMakeCurrent(array_spu.context[slot].clientState); 811 } 812 else 813 { 814 crStateMakeCurrent(NULL); 815 } 816 817 #ifdef CHROMIUM_THREADSAFE 818 crUnlockMutex(&_ArrayMutex); 819 #endif 820 } 821 822 static void ARRAYSPU_APIENTRY 823 arrayspu_DestroyContext( GLint ctx ) 824 { 825 #ifdef CHROMIUM_THREADSAFE 826 crLockMutex(&_ArrayMutex); 827 #endif 828 array_spu.child.DestroyContext(ctx); 829 830 if (ctx) { 831 int slot; 832 833 for (slot=0; slot<array_spu.numContexts; ++slot) 834 if (array_spu.context[slot].clientCtx == ctx) break; 835 CRASSERT(slot < array_spu.numContexts); 836 837 crStateDestroyContext(array_spu.context[slot].clientState); 838 839 array_spu.context[slot].clientState = NULL; 840 array_spu.context[slot].clientCtx = 0; 841 } 842 843 #ifdef CHROMIUM_THREADSAFE 844 crUnlockMutex(&_ArrayMutex); 845 #endif 846 } 756 847 757 848 SPUNamedFunctionTable _cr_array_table[] = { … … 793 884 { "GetBufferPointervARB", (SPUGenericFunction) arrayspu_GetBufferPointervARB}, 794 885 { "InterleavedArrays", (SPUGenericFunction) arrayspu_InterleavedArrays}, 886 { "CreateContext", (SPUGenericFunction) arrayspu_CreateContext}, 887 { "MakeCurrent", (SPUGenericFunction) arrayspu_MakeCurrent}, 888 { "DestroyContext", (SPUGenericFunction) arrayspu_DestroyContext}, 795 889 { NULL, NULL } 796 890 };
Note:
See TracChangeset
for help on using the changeset viewer.