ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

vbo_save.h
Go to the documentation of this file.
00001 /**************************************************************************
00002 
00003 Copyright 2002 Tungsten Graphics Inc., Cedar Park, Texas.
00004 
00005 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 on the rights to use, copy, modify, merge, publish, distribute, sub
00011 license, and/or sell copies of the Software, and to permit persons to whom
00012 the Software is furnished to do so, subject to the following conditions:
00013 
00014 The above copyright notice and this permission notice (including the next
00015 paragraph) shall be included in all copies or substantial portions of the
00016 Software.
00017 
00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00020 FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
00021 TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
00022 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
00023 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
00024 USE OR OTHER DEALINGS IN THE SOFTWARE.
00025 
00026 **************************************************************************/
00027 
00028 /*
00029  * Authors:
00030  *   Keith Whitwell <keith@tungstengraphics.com>
00031  *
00032  */
00033 
00034 #ifndef VBO_SAVE_H
00035 #define VBO_SAVE_H
00036 
00037 #include "main/mtypes.h"
00038 #include "vbo.h"
00039 #include "vbo_attrib.h"
00040 
00041 
00042 struct vbo_save_copied_vtx {
00043    GLfloat buffer[VBO_ATTRIB_MAX * 4 * VBO_MAX_COPIED_VERTS];
00044    GLuint nr;
00045 };
00046 
00047 
00048 /* For display lists, this structure holds a run of vertices of the
00049  * same format, and a strictly well-formed set of begin/end pairs,
00050  * starting on the first vertex and ending at the last.  Vertex
00051  * copying on buffer breaks is precomputed according to these
00052  * primitives, though there are situations where the copying will need
00053  * correction at execute-time, perhaps by replaying the list as
00054  * immediate mode commands.
00055  *
00056  * On executing this list, the 'current' values may be updated with
00057  * the values of the final vertex, and often no fixup of the start of
00058  * the vertex list is required.
00059  *
00060  * Eval and other commands that don't fit into these vertex lists are
00061  * compiled using the fallback opcode mechanism provided by dlist.c.
00062  */
00063 struct vbo_save_vertex_list {
00064    GLubyte attrsz[VBO_ATTRIB_MAX];
00065    GLuint vertex_size;
00066 
00067    GLuint buffer_offset;
00068    GLuint count;
00069    GLuint wrap_count;       /* number of copied vertices at start */
00070    GLboolean dangling_attr_ref; /* current attr implicitly referenced 
00071                    outside the list */
00072 
00073    struct _mesa_prim *prim;
00074    GLuint prim_count;
00075 
00076    struct vbo_save_vertex_store *vertex_store;
00077    struct vbo_save_primitive_store *prim_store;
00078 };
00079 
00080 /* These buffers should be a reasonable size to support upload to
00081  * hardware.  Current vbo implementation will re-upload on any
00082  * changes, so don't make too big or apps which dynamically create
00083  * dlists and use only a few times will suffer.
00084  *
00085  * Consider stategy of uploading regions from the VBO on demand in the
00086  * case of dynamic vbos.  Then make the dlist code signal that
00087  * likelyhood as it occurs.  No reason we couldn't change usage
00088  * internally even though this probably isn't allowed for client VBOs?
00089  */
00090 #define VBO_SAVE_BUFFER_SIZE (8*1024) /* dwords */
00091 #define VBO_SAVE_PRIM_SIZE   128
00092 #define VBO_SAVE_PRIM_WEAK 0x40
00093 
00094 #define VBO_SAVE_FALLBACK    0x10000000
00095 
00096 /* Storage to be shared among several vertex_lists.
00097  */
00098 struct vbo_save_vertex_store {
00099    struct gl_buffer_object *bufferobj;
00100    GLfloat *buffer;
00101    GLuint used;
00102    GLuint refcount;
00103 };
00104 
00105 struct vbo_save_primitive_store {
00106    struct _mesa_prim buffer[VBO_SAVE_PRIM_SIZE];
00107    GLuint used;
00108    GLuint refcount;
00109 };
00110 
00111 
00112 struct vbo_save_context {
00113    GLcontext *ctx;
00114    GLvertexformat vtxfmt;
00115    struct gl_client_array arrays[VBO_ATTRIB_MAX];
00116    const struct gl_client_array *inputs[VBO_ATTRIB_MAX];
00117 
00118    GLubyte attrsz[VBO_ATTRIB_MAX];
00119    GLubyte active_sz[VBO_ATTRIB_MAX];
00120    GLuint vertex_size;
00121 
00122    GLfloat *buffer;
00123    GLuint count;
00124    GLuint wrap_count;
00125    GLuint replay_flags;
00126 
00127    struct _mesa_prim *prim;
00128    GLuint prim_count, prim_max;
00129 
00130    struct vbo_save_vertex_store *vertex_store;
00131    struct vbo_save_primitive_store *prim_store;
00132 
00133    GLfloat *vbptr;         /* cursor, points into buffer */
00134    GLfloat vertex[VBO_ATTRIB_MAX*4];       /* current values */
00135    GLfloat *attrptr[VBO_ATTRIB_MAX];
00136    GLuint vert_count;
00137    GLuint max_vert;
00138    GLboolean dangling_attr_ref;
00139    GLboolean have_materials;
00140 
00141    GLuint opcode_vertex_list;
00142 
00143    struct vbo_save_copied_vtx copied;
00144    
00145    GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->ListState */
00146    GLubyte *currentsz[VBO_ATTRIB_MAX];
00147 };
00148 
00149 
00150 void vbo_save_init( GLcontext *ctx );
00151 void vbo_save_destroy( GLcontext *ctx );
00152 void vbo_save_fallback( GLcontext *ctx, GLboolean fallback );
00153 
00154 /* save_loopback.c:
00155  */
00156 void vbo_loopback_vertex_list( GLcontext *ctx,
00157                    const GLfloat *buffer,
00158                    const GLubyte *attrsz,
00159                    const struct _mesa_prim *prim,
00160                    GLuint prim_count,
00161                    GLuint wrap_count,
00162                    GLuint vertex_size);
00163 
00164 /* Callbacks:
00165  */
00166 void vbo_save_EndList( GLcontext *ctx );
00167 void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode );
00168 void vbo_save_EndCallList( GLcontext *ctx );
00169 void vbo_save_BeginCallList( GLcontext *ctx, struct mesa_display_list *list );
00170 void vbo_save_SaveFlushVertices( GLcontext *ctx );
00171 GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode );
00172 
00173 void vbo_save_playback_vertex_list( GLcontext *ctx, void *data );
00174 
00175 void vbo_save_api_init( struct vbo_save_context *save );
00176 
00177 #endif

Generated on Sun May 27 2012 04:20:48 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.