- 時間撮記:
- 2009-9-18 上午11:21:22 (15 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c
r22832 r23123 48 48 49 49 b->buffers = crAllocHashtable(); 50 51 b->bResyncNeeded = GL_FALSE; 50 52 } 51 53 … … 72 74 crFree(b->nullBuffer); 73 75 } 74 75 76 76 77 void STATE_APIENTRY … … 750 751 } 751 752 753 static void crStateBufferObjectSyncCB(unsigned long key, void *data1, void *data2) 754 { 755 CRBufferObject *pBufferObj = (CRBufferObject *) data1; 756 CRBufferObjectState *pState = (CRBufferObjectState *) data2; 757 758 if (pBufferObj->data) 759 { 760 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, pBufferObj->name); 761 diff_api.BufferDataARB(GL_ARRAY_BUFFER_ARB, pBufferObj->size, pBufferObj->data, pBufferObj->usage); 762 763 if (!pState->retainBufferData) 764 { 765 crFree(pBufferObj->data); 766 pBufferObj->data = NULL; 767 } 768 } 769 } 752 770 753 771 /* … … 758 776 { 759 777 const CRBufferObjectState *from = &(fromCtx->bufferobject); 760 const CRBufferObjectState *to = &(toCtx->bufferobject); 778 CRBufferObjectState *to = &(toCtx->bufferobject); 779 int i; 761 780 762 781 if (!HaveBufferObjectExtension()) 763 782 return; 783 784 if (to->bResyncNeeded) 785 { 786 CRClientPointer *cp; 787 788 crHashtableWalk(to->buffers, crStateBufferObjectSyncCB, to); 789 to->bResyncNeeded = GL_FALSE; 790 791 /*@todo, move to state_client.c*/ 792 793 cp = &toCtx->client.array.v; 794 if (cp->buffer->name) 795 { 796 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 797 diff_api.VertexPointer(cp->size, cp->type, cp->stride, cp->p); 798 } 799 800 cp = &toCtx->client.array.c; 801 if (cp->buffer->name) 802 { 803 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 804 diff_api.ColorPointer(cp->size, cp->type, cp->stride, cp->p); 805 } 806 807 cp = &toCtx->client.array.f; 808 if (cp->buffer->name) 809 { 810 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 811 diff_api.FogCoordPointerEXT(cp->type, cp->stride, cp->p); 812 } 813 814 cp = &toCtx->client.array.s; 815 if (cp->buffer->name) 816 { 817 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 818 diff_api.SecondaryColorPointerEXT(cp->size, cp->type, cp->stride, cp->p); 819 } 820 821 cp = &toCtx->client.array.e; 822 if (cp->buffer->name) 823 { 824 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 825 diff_api.EdgeFlagPointer(cp->stride, cp->p); 826 } 827 828 cp = &toCtx->client.array.i; 829 if (cp->buffer->name) 830 { 831 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 832 diff_api.IndexPointer(cp->type, cp->stride, cp->p); 833 } 834 835 cp = &toCtx->client.array.n; 836 if (cp->buffer->name) 837 { 838 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 839 diff_api.NormalPointer(cp->type, cp->stride, cp->p); 840 } 841 842 for (i = 0; i < CR_MAX_TEXTURE_UNITS; i++) 843 { 844 cp = &toCtx->client.array.t[i]; 845 if (cp->buffer->name) 846 { 847 if (diff_api.ActiveTextureARB) 848 diff_api.ActiveTextureARB(i+GL_TEXTURE0_ARB); 849 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 850 diff_api.TexCoordPointer(cp->size, cp->type, cp->stride, cp->p); 851 } 852 } 853 854 if (diff_api.ActiveTextureARB) 855 diff_api.ActiveTextureARB(toCtx->client.curClientTextureUnit+GL_TEXTURE0_ARB); 856 857 #ifdef CR_NV_vertex_program 858 for (i = 0; i < CR_MAX_VERTEX_ATTRIBS; i++) 859 { 860 cp = &toCtx->client.array.a[i]; 861 if (cp->buffer->name) 862 { 863 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, cp->buffer->name); 864 diff_api.VertexAttribPointerARB(i, cp->size, cp->type, cp->normalized, cp->stride, cp->p); 865 } 866 } 867 #endif 868 diff_api.BindBufferARB(GL_ARRAY_BUFFER_ARB, to->arrayBuffer->name); 869 diff_api.BindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, to->elementsBuffer->name); 870 } 764 871 765 872 /* ARRAY_BUFFER binding */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器