Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1901 serge 1
/*
2
 * mesa 3-D graphics library
3
 * Version:  6.5
4
 *
5
 * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
6
 *
7
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 * copy of this software and associated documentation files (the "Software"),
9
 * to deal in the Software without restriction, including without limitation
10
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 * and/or sell copies of the Software, and to permit persons to whom the
12
 * Software is furnished to do so, subject to the following conditions:
13
 *
14
 * The above copyright notice and this permission notice shall be included
15
 * in all copies or substantial portions of the Software.
16
 *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 */
24
 
25
/**
26
 * \file vbo_context.h
27
 * \brief VBO builder module datatypes and definitions.
28
 * \author Keith Whitwell
29
 */
30
 
31
 
32
/**
33
 * \mainpage The VBO builder module
34
 *
35
 * This module hooks into the GL dispatch table and catches all vertex
36
 * building and drawing commands, such as glVertex3f, glBegin and
37
 * glDrawArrays.  The module stores all incoming vertex data as arrays
38
 * in GL vertex buffer objects (VBOs), and translates all drawing
39
 * commands into calls to a driver supplied DrawPrimitives() callback.
40
 *
41
 * The module captures both immediate mode and display list drawing,
42
 * and manages the allocation, reference counting and deallocation of
43
 * vertex buffer objects itself.
44
 *
45
 * The DrawPrimitives() callback can be either implemented by the
46
 * driver itself or hooked to the tnl module's _tnl_draw_primitives()
47
 * function for hardware without tnl capablilties or during fallbacks.
48
 */
49
 
50
 
51
#ifndef _VBO_CONTEXT_H
52
#define _VBO_CONTEXT_H
53
 
54
#include "vbo.h"
55
#include "vbo_attrib.h"
56
#include "vbo_exec.h"
57
#include "vbo_save.h"
58
 
59
 
60
struct vbo_context {
61
   struct gl_client_array currval[VBO_ATTRIB_MAX];
62
 
63
   /* These point into the above.  TODO: remove.
64
    */
65
   struct gl_client_array *legacy_currval;
66
   struct gl_client_array *generic_currval;
67
   struct gl_client_array *mat_currval;
68
 
69
   GLuint map_vp_none[VERT_ATTRIB_MAX];
70
   GLuint map_vp_arb[VERT_ATTRIB_MAX];
71
 
72
   GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */
73
   GLfloat CurrentFloatEdgeFlag;
74
 
75
 
76
   struct vbo_exec_context exec;
77
#if FEATURE_dlist
78
   struct vbo_save_context save;
79
#endif
80
 
81
   /* Callback into the driver.  This must always succeed, the driver
82
    * is responsible for initiating any fallback actions required:
83
    */
84
   vbo_draw_func draw_prims;
85
};
86
 
87
 
88
static INLINE struct vbo_context *vbo_context(struct gl_context *ctx)
89
{
90
   return (struct vbo_context *)(ctx->swtnl_im);
91
}
92
 
93
 
94
/**
95
 * Return VP_x token to indicate whether we're running fixed-function
96
 * vertex transformation, an NV vertex program or ARB vertex program/shader.
97
 */
98
static INLINE enum vp_mode
99
get_program_mode( struct gl_context *ctx )
100
{
101
   if (!ctx->VertexProgram._Current)
102
      return VP_NONE;
103
   else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram)
104
      return VP_NONE;
105
   else if (ctx->VertexProgram._Current->IsNVProgram)
106
      return VP_NV;
107
   else
108
      return VP_ARB;
109
}
110
 
111
 
112
#endif