Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenvbo_save.c
Go to the documentation of this file.
00001 /* 00002 * Mesa 3-D graphics library 00003 * Version: 7.2 00004 * 00005 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. 00006 * 00007 * Permission is hereby granted, free of charge, to any person obtaining a 00008 * copy of this software and associated documentation files (the "Software"), 00009 * to deal in the Software without restriction, including without limitation 00010 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 * and/or sell copies of the Software, and to permit persons to whom the 00012 * Software is furnished to do so, subject to the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00018 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00021 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00022 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00023 * 00024 * Authors: 00025 * Keith Whitwell <keith@tungstengraphics.com> 00026 */ 00027 00028 00029 #include "main/mtypes.h" 00030 #include "main/bufferobj.h" 00031 #include "main/dlist.h" 00032 #include "main/vtxfmt.h" 00033 #include "main/imports.h" 00034 00035 #include "vbo_context.h" 00036 00037 00038 00039 static void vbo_save_callback_init( GLcontext *ctx ) 00040 { 00041 ctx->Driver.NewList = vbo_save_NewList; 00042 ctx->Driver.EndList = vbo_save_EndList; 00043 ctx->Driver.SaveFlushVertices = vbo_save_SaveFlushVertices; 00044 ctx->Driver.BeginCallList = vbo_save_BeginCallList; 00045 ctx->Driver.EndCallList = vbo_save_EndCallList; 00046 ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin; 00047 } 00048 00049 00050 00051 void vbo_save_init( GLcontext *ctx ) 00052 { 00053 struct vbo_context *vbo = vbo_context(ctx); 00054 struct vbo_save_context *save = &vbo->save; 00055 00056 save->ctx = ctx; 00057 00058 vbo_save_api_init( save ); 00059 vbo_save_callback_init(ctx); 00060 00061 { 00062 struct gl_client_array *arrays = save->arrays; 00063 memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0])); 00064 memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0])); 00065 } 00066 00067 ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; 00068 } 00069 00070 00071 void vbo_save_destroy( GLcontext *ctx ) 00072 { 00073 struct vbo_context *vbo = vbo_context(ctx); 00074 struct vbo_save_context *save = &vbo->save; 00075 GLuint i; 00076 00077 if (save->prim_store) { 00078 if ( --save->prim_store->refcount == 0 ) { 00079 FREE( save->prim_store ); 00080 save->prim_store = NULL; 00081 } 00082 if ( --save->vertex_store->refcount == 0 ) { 00083 _mesa_reference_buffer_object(ctx, 00084 &save->vertex_store->bufferobj, NULL); 00085 FREE( save->vertex_store ); 00086 save->vertex_store = NULL; 00087 } 00088 } 00089 00090 for (i = 0; i < VBO_ATTRIB_MAX; i++) { 00091 _mesa_reference_buffer_object(ctx, &save->arrays[i].BufferObj, NULL); 00092 } 00093 } 00094 00095 00096 00097 00098 /* Note that this can occur during the playback of a display list: 00099 */ 00100 void vbo_save_fallback( GLcontext *ctx, GLboolean fallback ) 00101 { 00102 struct vbo_save_context *save = &vbo_context(ctx)->save; 00103 00104 if (fallback) 00105 save->replay_flags |= VBO_SAVE_FALLBACK; 00106 else 00107 save->replay_flags &= ~VBO_SAVE_FALLBACK; 00108 } 00109 00110 Generated on Sun May 27 2012 04:20:48 for ReactOS by
1.7.6.1
|