~noskcaj/ubuntu/trusty/cogl/1.16.2

« back to all changes in this revision

Viewing changes to cogl/cogl-pipeline-opengl-private.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha, Jeremy Bicha, Rico Tzschichholz
  • Date: 2013-02-26 16:43:25 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20130226164325-t4z9rylpa20v0p6q
Tags: 1.13.4-0ubuntu1
[ Jeremy Bicha ]
* New upstream release
  - soname bump
* debian/control.in:
  - Bump minimum glib to 2.32
  - Drop obsolete breaks/replaces
  - Bump libclutter-1.0-dev breaks for soname transition
* debian/libcogl-dev.install:
  - Add some missing files

[ Rico Tzschichholz ]
* debian/control.in:
  - Build-depend on libxrandr-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Cogl
3
 
 *
4
 
 * An object oriented GL/GLES Abstraction/Utility Layer
5
 
 *
6
 
 * Copyright (C) 2010 Intel Corporation.
7
 
 *
8
 
 * This library is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Lesser General Public
10
 
 * License as published by the Free Software Foundation; either
11
 
 * version 2 of the License, or (at your option) any later version.
12
 
 *
13
 
 * This library is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * Lesser General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU Lesser General Public
19
 
 * License along with this library. If not, see
20
 
 * <http://www.gnu.org/licenses/>.
21
 
 *
22
 
 *
23
 
 *
24
 
 * Authors:
25
 
 *   Robert Bragg <robert@linux.intel.com>
26
 
 */
27
 
 
28
 
#ifndef __COGL_PIPELINE_OPENGL_PRIVATE_H
29
 
#define __COGL_PIPELINE_OPENGL_PRIVATE_H
30
 
 
31
 
#include "cogl-pipeline-private.h"
32
 
#include "cogl-matrix-stack.h"
33
 
 
34
 
/*
35
 
 * cogl-pipeline.c owns the GPU's texture unit state so we have some
36
 
 * private structures for describing the current state of a texture
37
 
 * unit that we track in a per context array (ctx->texture_units) that
38
 
 * grows according to the largest texture unit used so far...
39
 
 *
40
 
 * Roughly speaking the members in this structure are of two kinds:
41
 
 * either they are a low level reflection of the state we send to
42
 
 * OpenGL or they are for high level meta data assoicated with the
43
 
 * texture unit when flushing CoglPipelineLayers that is typically
44
 
 * used to optimize subsequent re-flushing of the same layer.
45
 
 *
46
 
 * The low level members are at the top, and the high level members
47
 
 * start with the .layer member.
48
 
 */
49
 
typedef struct _CoglTextureUnit
50
 
{
51
 
  /* The base 0 texture unit index which can be used with
52
 
   * glActiveTexture () */
53
 
  int                index;
54
 
 
55
 
  /* The GL target currently glEnabled or 0 if nothing is
56
 
   * enabled. This is only used by the fixed pipeline fragend */
57
 
  GLenum             enabled_gl_target;
58
 
 
59
 
  /* The raw GL texture object name for which we called glBindTexture when
60
 
   * we flushed the last layer. (NB: The CoglTexture associated
61
 
   * with a layer may represent more than one GL texture) */
62
 
  GLuint             gl_texture;
63
 
  /* The target of the GL texture object. This is just used so that we
64
 
   * can quickly determine the intended target to flush when
65
 
   * dirty_gl_texture == TRUE */
66
 
  GLenum             gl_target;
67
 
 
68
 
  /* Foreign textures are those not created or deleted by Cogl. If we ever
69
 
   * call glBindTexture for a foreign texture then the next time we are
70
 
   * asked to glBindTexture we can't try and optimize a redundant state
71
 
   * change because we don't know if the original texture name was deleted
72
 
   * and now we are being asked to bind a recycled name. */
73
 
  CoglBool           is_foreign;
74
 
 
75
 
  /* We have many components in Cogl that need to temporarily bind arbitrary
76
 
   * textures e.g. to query texture object parameters and since we don't
77
 
   * want that to result in too much redundant reflushing of layer state
78
 
   * when all that's needed is to re-bind the layer's gl_texture we use this
79
 
   * to track when the unit->gl_texture state is out of sync with the GL
80
 
   * texture object really bound too (GL_TEXTURE0+unit->index).
81
 
   *
82
 
   * XXX: as a further optimization cogl-pipeline.c uses a convention
83
 
   * of always using texture unit 1 for these transient bindings so we
84
 
   * can assume this is only ever TRUE for unit 1.
85
 
   */
86
 
  CoglBool           dirty_gl_texture;
87
 
 
88
 
  /* A matrix stack giving us the means to associate a texture
89
 
   * transform matrix with the texture unit. */
90
 
  CoglMatrixStack   *matrix_stack;
91
 
 
92
 
  /*
93
 
   * Higher level layer state associated with the unit...
94
 
   */
95
 
 
96
 
  /* The CoglPipelineLayer whos state was flushed to update this
97
 
   * texture unit last.
98
 
   *
99
 
   * This will be set to NULL if the layer is modified or freed which
100
 
   * means when we come to flush a layer; if this pointer is still
101
 
   * valid and == to the layer being flushed we don't need to update
102
 
   * any texture unit state. */
103
 
  CoglPipelineLayer *layer;
104
 
 
105
 
  /* To help minimize the state changes required we track the
106
 
   * difference flags associated with the layer whos state was last
107
 
   * flushed to update this texture unit.
108
 
   *
109
 
   * Note: we track this explicitly because .layer may get invalidated
110
 
   * if that layer is modified or deleted. Even if the layer is
111
 
   * invalidated though these flags can be used to optimize the state
112
 
   * flush of the next layer
113
 
   */
114
 
  unsigned long      layer_changes_since_flush;
115
 
 
116
 
  /* Whenever a CoglTexture's internal GL texture storage changes
117
 
   * cogl-pipeline.c is notified with a call to
118
 
   * _cogl_pipeline_texture_storage_change_notify which inturn sets
119
 
   * this to TRUE for each texture unit that it is currently bound
120
 
   * too. When we later come to flush some pipeline state then we will
121
 
   * always check this to potentially force an update of the texture
122
 
   * state even if the pipeline hasn't changed. */
123
 
  CoglBool           texture_storage_changed;
124
 
 
125
 
} CoglTextureUnit;
126
 
 
127
 
CoglTextureUnit *
128
 
_cogl_get_texture_unit (int index_);
129
 
 
130
 
void
131
 
_cogl_destroy_texture_units (void);
132
 
 
133
 
void
134
 
_cogl_set_active_texture_unit (int unit_index);
135
 
 
136
 
void
137
 
_cogl_bind_gl_texture_transient (GLenum gl_target,
138
 
                                 GLuint gl_texture,
139
 
                                 CoglBool is_foreign);
140
 
 
141
 
void
142
 
_cogl_delete_gl_texture (GLuint gl_texture);
143
 
 
144
 
void
145
 
_cogl_pipeline_flush_gl_state (CoglPipeline *pipeline,
146
 
                               CoglFramebuffer *framebuffer,
147
 
                               CoglBool skip_gl_state,
148
 
                               int n_tex_coord_attribs);
149
 
 
150
 
#endif /* __COGL_PIPELINE_OPENGL_PRIVATE_H */
151